simple-socket library 1.1.5
|
00001 #ifndef NET_InternetSocket_h__ 00002 #define NET_InternetSocket_h__ 00003 00004 #include "SimpleSocket.h" 00005 00006 struct sockaddr_in; 00007 00008 namespace NET 00009 { 00011 class InternetSocket : public SimpleSocket 00012 { 00013 public: 00015 00026 void connect( const std::string& foreignAddress, unsigned short foreignPort); 00027 00033 void bind( unsigned short localPort = 0); 00034 00036 00055 void bind( const std::string& localAddress, unsigned short localPort = 0); 00056 00062 std::string getLocalAddress() const; 00063 00069 unsigned short getLocalPort() const; 00070 00076 std::string getForeignAddress() const; 00077 00083 unsigned short getForeignPort() const; 00084 00085 protected: 00087 InternetSocket( int sockfd); 00088 00090 InternetSocket( int type, int protocol); 00091 00102 static void fillAddress( const std::string& address, unsigned short port, sockaddr_in& addr); 00103 }; 00104 00105 } // namespace NET 00106 00107 #endif // NET_InternetSocket_h__