00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef NET_H
00012 #define NET_H
00013
00014 #include <stdlib.h>
00015 #include "s3e.h"
00016 #include "s3eOSReadString.h"
00017 #include "string"
00018
00024 class Net {
00025
00026 public:
00033 Net(char* myIP,
00034 char* opponentIP,
00035 uint16 port);
00036
00040 ~Net(){}
00041
00048 static s3eInetAddress* SetUpAddress(char* ip,
00049 uint16 port);
00050
00054 static void Bind();
00055
00060 static std::string RecieveData();
00061
00066 static char* GetMyIP();
00067
00075 static int32 ConnectCallback(s3eSocket *socket,
00076 void *sys,
00077 void *data);
00078
00084 static void IncomingConnection(s3eSocket *newSocket,
00085 s3eInetAddress *address);
00086
00094 static int32 AcceptCallback(s3eSocket *sock,
00095 void *sysData,
00096 void *userData);
00097
00101 static void Listen();
00102
00108 static void Connect(char* IP,
00109 uint16 port);
00110
00115 void SendData(char* msg);
00116
00117 protected:
00119 static char* m_myIp;
00120
00122 static char* m_opponentIp;
00123
00125 static uint16 m_port;
00126
00128 static s3eSocket *m_socket;
00129
00131 static bool m_SocketIsConnected;
00132
00134 static s3eSocket *m_AcceptedSocket;
00135
00137 static bool m_Listening;
00138 };
00139 #endif