TcpCx.hh

00001 /*
00002 ** Stechec project is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 2 of the License, or
00005 ** (at your option) any later version.
00006 **
00007 ** The complete GNU General Public Licence Notice can be found as the
00008 ** `NOTICE' file in the root directory.
00009 **
00010 ** Copyright (C) 2007 Prologin
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 /* !TCPCX_HH_ */

Generated on Sat Jun 23 16:07:24 2007 for Stechec/TBT by  doxygen 1.4.7