00001 #ifndef _WINC_SOCKET
00002 #define _WINC_SOCKET
00003
00004 namespace WXP {
00005 class Socket {
00006 int type;
00007 char host[50];
00008 int port;
00009 int fd;
00010 int sfd;
00011 unsigned char data[1000];
00012 int size;
00013 int ind;
00014 bool opened;
00015
00016 public:
00017 Socket( );
00018 ~Socket( );
00019 int init();
00020 bool isOpen();
00021 int open( const char *address, int type );
00022 int close();
00023 int reconnect();
00024 int read( unsigned char *buf, int size );
00025 int readLine( unsigned char *buf, int size );
00026 int write( const unsigned char *buf, int size );
00027
00028
00029
00030
00031 enum Type {
00032 UNK,
00033 DGRAM,
00034 DGRAM_SERVER,
00035 DGRAM_CLIENT,
00036 STREAM,
00037 STREAM_SERVER,
00038 STREAM_CLIENT
00039 };
00040 };
00041 }
00042 #endif