diff options
Diffstat (limited to 'lib/socket.h')
-rw-r--r-- | lib/socket.h | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/lib/socket.h b/lib/socket.h index dde4729..f82cd82 100644 --- a/lib/socket.h +++ b/lib/socket.h @@ -3,7 +3,7 @@ * socket.h * * Mon Nov 8 10:49:33 CET 2004 - * Copyright 2004 Bent Bisballe + * Copyright 2004 Bent Bisballe Nyeng * deva@aasimon.org ****************************************************************************/ @@ -24,10 +24,49 @@ * along with MIaV; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "config.h" -#ifndef __MIAVLIB_SOCKET_H__ -#define __MIAVLIB_SOCKET_H__ +#ifndef __MIAV_SOCKET_H__ +#define __MIAV_SOCKET_H__ +#include <string> + +#define PORT_UNDEFINED -1 + +class Network; + +class Socket { + friend class Network; + // friend class Socket; +public: + Socket(int port, std::string addr); + ~Socket(); + + int setPort(int port); + int port(); + + int setAddress(std::string addr); + std::string address(); + + int connect(); + int disconnect(); + + std::string error(); + +protected: + bool connected; + + // Error string + std::string strerr; + + // c socket + int sock; + + // host info + int prt; + std::string addr; +}; + + +/* // Old interface #include <stdio.h> #include <string.h> @@ -42,6 +81,7 @@ public: Socket(); Socket(u_short port); ~Socket(); + Socket slisten(); int sconnect(char *ip); bool isConnected(); @@ -54,5 +94,7 @@ public: private: int err; }; +*/ + #endif/*__SOCKET_H__*/ |