summaryrefslogtreecommitdiff
path: root/lib/socket.h
diff options
context:
space:
mode:
authordeva <deva>2006-08-25 21:20:07 +0000
committerdeva <deva>2006-08-25 21:20:07 +0000
commit8196872e3b240ef93fc17dd3c05a7d97a8015d88 (patch)
treee531edeb1c7178a8e58170c84645ce8eb706624e /lib/socket.h
parent347b1d8ed3a4f780f3a5c0d57a04eab05ca517a2 (diff)
Rearranged the network and socket code.origin
Added status messages sent over the network using udp packets.
Diffstat (limited to 'lib/socket.h')
-rw-r--r--lib/socket.h50
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__*/