#ifndef NET_CLIENT_H #define NET_CLIENT_H #include #include #include #include #include "my_sock_wrapper.h" class NET_Client { public: /*private*/ int clientfd; struct sockaddr_in clientsocket; int clientlen ; char remotehostname[255]; int id; char clientName[255]; bool pure; //if true, pure connect/send/recv; //if false, sends clientname after connect;packet length header in send/recv public: NET_Client(bool is_pure=false); virtual ~NET_Client(); void setClientName(char *name); int connect(char *host, int port); // Just pass through to the raw read/write system commands int read(void *buf, int size); int write (void *buf, int size); // Reads one whole packet sent with writeNetMsg. int readNetMsg(void *buf, int size); int writeNetMsg(void *buf, int size); int getblocking(); void setblocking(int isblocking); void nonblocking(); void blocking(); char *remoteHostname(); }; #endif