basesocket (482B)
1 #ifndef _BASESOCKET_ 2 #define _BASESOCKET_ 3 4 #include "sys/sys" 5 #include "config/config" 6 7 class Basesocket { 8 public: 9 Basesocket(); 10 Basesocket(int fd); 11 ~Basesocket(); 12 13 int fd(); 14 void fd(int f); 15 16 void bind(string const &addr, int port); 17 bool operator==(Basesocket const &other) const; 18 void close(); 19 Basesocket *accept(); 20 struct sockaddr_in clientaddr(); 21 22 private: 23 int _fd; 24 int _initialized; 25 struct sockaddr_in _clientaddr; 26 }; 27 28 #endif