Include the main header for the library.
Add to the manifest the dependency.
This two steps should be enough to compile and link with the library.
First create the object and initialize it.
The class constructor will setup the socket but will NOT open it. The first argument of the constructor is the IP of the server and the second the port number to use.
The class can also be used in asynchronous communications by using the following constructor:
The user is responsible for the interception of communication signals (
SIGIO) and its handling.
Class usage is very simple, the user must only class the desired function to
char output_message; char input_message; memset(output_message,0,sizeof(output_message)); memset(input_message,0,sizeof(input_message)); strcpy(output_message,"I'm alive"); comm.Send(output_message,strlen(output_message)); comm.perr("Could not send message"); if(!comm.err) printf("Message \"%s\", sent successfully\n",output_message); comm.Receive(input_message,sizeof(input_message)); comm.perr("Could not receive message"); if(!comm.err) printf("Message \"%s\", received\n",input_message);