00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef TCPCX_HH_
00014 # define TCPCX_HH_
00015
00016 # include "Cx.hh"
00017
00042 class TcpCx : public Cx
00043 {
00044 public:
00045 TcpCx();
00046 virtual ~TcpCx();
00047
00055 void connect(const char* host, int port);
00056
00062 void listen(int port);
00063
00068 TcpCx* accept();
00069
00070 protected:
00071 virtual bool pollInternal(int* timeout);
00072 virtual int recvData(bool use_exception);
00073 virtual void sendData(unsigned char* data, unsigned size);
00074 virtual void print(std::ostream& os) const;
00075
00076 private:
00078 TcpCx(int fd);
00079
00080 void setSocketOptions();
00081
00082 int remote_port_;
00083 int remote_ip_;
00084 };
00085
00086 #endif