2 #include <sys/socket.h>
3 #include <netinet/in.h>
14 #include "thread_util.h"
23 Network(int newPort = 4560);
25 bool Valid() const {return sfd != -1;}
27 bool SendMessage(const char * print, ...); //Sends a formated message (NOTE: Prints a newline)
28 bool SendMessage(const std::string & buffer) {return SendMessage(buffer.c_str());} //Sends a C++ string message
29 bool GetMessage(std::string & buffer, double timeout=-1); //Retrieves a message, or waits for a timeout (if positive)
38 class Server : public Network
41 Server(int newPort = 4560);
46 class Client : public Network
49 Client(const char * server = "127.0.0.1", int newPort = 4560);