diff --git a/Code/Network/NetworkAPI/NetworkClient.cpp b/Code/Network/NetworkAPI/NetworkClient.cpp index 9fa033f1..12d14144 100644 --- a/Code/Network/NetworkAPI/NetworkClient.cpp +++ b/Code/Network/NetworkAPI/NetworkClient.cpp @@ -48,8 +48,8 @@ struct ClientDataContainer InitWinSock(); callbackType = NetworkProtocolCallbackType_Unknown; sendPostBox = new PostBox(); - connection.SetBlockingMode(false); connection.InitiateClient(); + connection.SetBlockingMode(false); } ClientDataContainer(IThreadObject* o, unsigned int socket ) :connection(socket), ID(currID++) @@ -204,17 +204,17 @@ NetworkClient::~NetworkClient() bool NetworkClient::Connect(unsigned short port, const char serverIP[]) { + privateData->data->connection.SetBlockingMode(true); int result = this->privateData->data->connection.Connect(port, serverIP); //Connect has succeeded if(result == 0) { privateData->data->thread.Start(); + privateData->data->connection.SetBlockingMode(false); return true; } - privateData->data->connection.SetBlockingMode(false); - //Connect has failed return false; } diff --git a/Code/Network/OysterNetworkClient/ClientMain.cpp b/Code/Network/OysterNetworkClient/ClientMain.cpp index 2d008356..b4eb91d7 100644 --- a/Code/Network/OysterNetworkClient/ClientMain.cpp +++ b/Code/Network/OysterNetworkClient/ClientMain.cpp @@ -31,7 +31,7 @@ int main() //Connect to server //errorCode = client->Connect(15151, "193.11.186.101"); - errorCode = client.Connect(15151, "127.0.0.1"); + errorCode = client.Connect(15151, "193.11.187.62"); client.SetRecieverObject(proc, NetworkProtocolCallbackType_Function); if(errorCode != 1) diff --git a/Code/Network/OysterNetworkServer/ServerMain.cpp b/Code/Network/OysterNetworkServer/ServerMain.cpp index 48e36e8e..4f74cef9 100644 --- a/Code/Network/OysterNetworkServer/ServerMain.cpp +++ b/Code/Network/OysterNetworkServer/ServerMain.cpp @@ -4,12 +4,14 @@ #include #include "../NetworkDependencies/WinsockFunctions.h" #include "../NetworkAPI/NetworkServer.h" +#include "../NetworkAPI/CustomNetProtocol.h" +#include "../NetworkAPI/NetworkCallbackHelper.h" using namespace Oyster::Network; using namespace std; -vector clients; std::mutex m; +vector clients; void proc(NetworkClient client) {