Example of TCP SERVER Socket
#include <iostream>
using namespace std;
#include <netlink/socket.h>
int main() {
cout << "\nStarting server...";
cout.flush();
try {
clientConnection = server.
accept();
char buffer[256];
buffer[255] = '\0';
while(clientConnection->
read(buffer,255)) {
cout << "\nMessage: " << buffer;
cout.flush();
}
delete clientConnection;
cout << "\nClient disconnected. Exit...";
}
cout <<
"\n***Error*** " << e.
what();
if(clientConnection != NULL)
delete clientConnection;
}
return 0;
}