00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUSNSPRTCP_H
00020 #define CONEXUSNSPRTCP_H
00021
00022 #include <conexus-nspr/socket.h>
00023
00024 namespace Conexus {
00025
00026 namespace NSPR {
00027
00035 class TCP : public Socket {
00036 protected:
00037
00038 friend class TCPServer;
00039
00040 TCP( uint32_t address, uint16_t port );
00041
00042 TCP( const std::string& address, uint16_t port );
00043
00044 public:
00045
00046 typedef ConexusPointer<TCP> pointer;
00047
00048 CONEXUS_ENDPOINT_GENERIC_CREATE();
00049
00050 static pointer create( uint16_t port = 0 );
00051
00052 static pointer create( uint32_t address, uint16_t port );
00053
00054 static pointer create( const std::string& address, uint16_t port );
00055
00056 virtual ~TCP() throw();
00057
00064 virtual bool shutdown( ReadWrite read_write=READ_WRITE );
00065
00066 virtual void open() throw (open_exception);
00067
00068 virtual void connect() throw ( connect_exception );
00069 virtual void connect( Address& a ) throw ( connect_exception );
00070
00071 protected:
00072
00077 TCP( PRFileDesc* accepted_fd, bool );
00078
00079 static TCP::pointer create( PRFileDesc* accepted_fd, bool );
00080
00081 virtual void on_local_address_changed( );
00082 virtual void on_remote_address_changed( );
00083
00088 virtual size_t write_data( const Data data, Timeout timeout ) throw ( write_exception );
00089
00090 };
00091
00092 }
00093
00094 }
00095
00096 #endif