socketCtrl.h
00001 #ifndef SOCKET_CTRL_H
00002 #define SOCKET_CTRL_H
00003
00004
00005
00006
00007
00008
00009
00010 #include "socketInit.h"
00011 #include "ringBuffer.h"
00012 #include <SDL_net.h>
00013
00014
00015 class SocketCtrl : public SocketInit {
00016 bool is_disconnected;
00017 TCPsocket tcp_socket;
00018 RingBuffer<char> *recv_buffer;
00019
00020 static bool initialized;
00021 SocketCtrl(void);
00022 void bufferInit(int buffer_size);
00023 void check(void);
00024
00025 public:
00026 SocketCtrl(const char *host, Uint16 port, unsigned int buffer_size = BUFSIZ);
00027 SocketCtrl(TCPsocket tcpsocket, unsigned int buffer_size = BUFSIZ);
00028 ~SocketCtrl(void);
00029 void disconnect(void);
00030 TCPsocket& getTCPsocket(void);
00031 bool is_connect(void);
00032 int recv(void *area, unsigned int maxlen);
00033 int send(const void *area, int len);
00034 unsigned long size(void);
00035 };
00036
00037 #endif
00038