Network - Connection set blocking to true while connecting.
This commit is contained in:
parent
23a05bf431
commit
f31da90830
|
@ -48,8 +48,8 @@ struct ClientDataContainer
|
|||
InitWinSock();
|
||||
callbackType = NetworkProtocolCallbackType_Unknown;
|
||||
sendPostBox = new PostBox<CustomNetProtocol>();
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -4,12 +4,14 @@
|
|||
#include <mutex>
|
||||
#include "../NetworkDependencies/WinsockFunctions.h"
|
||||
#include "../NetworkAPI/NetworkServer.h"
|
||||
#include "../NetworkAPI/CustomNetProtocol.h"
|
||||
#include "../NetworkAPI/NetworkCallbackHelper.h"
|
||||
|
||||
using namespace Oyster::Network;
|
||||
using namespace std;
|
||||
|
||||
vector<NetworkClient> clients;
|
||||
std::mutex m;
|
||||
vector<NetworkClient> clients;
|
||||
|
||||
void proc(NetworkClient client)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue