Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

client.h

00001 #ifndef SOCKCLIENT_H
00002 #define SOCKCLIENT_H
00003 
00004 #define TRUE  1
00005 #define FALSE 0
00006 
00007 #ifdef SOLARIS
00008 #include <netinet/in.h>
00009 #endif
00010 
00011 #include <netdb.h>
00012 #include <sys/socket.h>
00013 
00014 
00015 class SockClient
00016 {
00017     public:
00018  
00019         int connect2Server(char* hostName, int portNum);
00020 
00021         int reconnect();
00022 
00023         void disconnect();
00024         void disconnect(char* bytes, int len);
00025             
00026             int readLine(char* buf, int maxBytes, struct timeval tout,
00027              int stripNLcharFlag=TRUE);
00028 
00029         int readn(char* buf, int nBytes, int timeOut);
00030 
00031         int writen(char* buf, int nBytes);
00032         
00033         const char* errMsg(int code);
00034         
00035         // Return Error Codes
00036         enum {
00037             E_NONE,
00038             E_SOCKET_CREAT = -1,
00039             E_CONNECT      = -2,
00040             E_HOST_LOOKUP  = -3,
00041             E_RD           = -4,
00042             E_SELECT       = -5,
00043             E_TIMEOUT      = -6,
00044             E_WRT          = -7,
00045             E_END          = -8
00046          };
00047         
00048     protected:
00049             int sockFd;
00050             
00051 
00052     private:
00053         struct sockaddr_in servAddr;
00054         int addrLen;
00055         struct hostent* host;
00056         static const char* errTable[];
00057 
00058 };
00059 
00060 #endif

Generated on Mon Apr 30 13:32:33 2007 for Parkes M & C - PKMC C++ library API by  doxygen 1.4.4