From f0dff0b728df61dcf779476defa35972f4c3e6f3 Mon Sep 17 00:00:00 2001 From: Pontus Fransson Date: Wed, 4 Dec 2013 12:41:25 +0100 Subject: [PATCH] Network - Starting to implement correct shutdown connection. --- .../NetworkDependencies/Connection.cpp | 20 +++++++++++++++++++ Code/Network/NetworkDependencies/Connection.h | 7 +++++-- .../OysterNetworkServer/ServerMain.cpp | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Code/Network/NetworkDependencies/Connection.cpp b/Code/Network/NetworkDependencies/Connection.cpp index 19556bbd..48767811 100644 --- a/Code/Network/NetworkDependencies/Connection.cpp +++ b/Code/Network/NetworkDependencies/Connection.cpp @@ -7,6 +7,20 @@ using namespace Oyster::Network; +Connection::Connection() +{ + this->socket = 0; + bool stillSending = false; + bool closed = true; +} + +Connection::Connection(int socket) +{ + this->socket = socket; + bool stillSending = false; + bool closed = true; +} + Connection::~Connection() { closesocket( this->socket ); @@ -30,6 +44,9 @@ int Connection::Connect(unsigned short port , const char serverName[]) return WSAGetLastError(); } + closed = false; + stillSending = true; + //connection succesfull! return 0; } @@ -63,6 +80,9 @@ int Connection::InitiateServer(unsigned short port) return errorCode; } + closed = false; + stillSending = true; + //Server started! return 0; } diff --git a/Code/Network/NetworkDependencies/Connection.h b/Code/Network/NetworkDependencies/Connection.h index 27933abf..09d8caea 100644 --- a/Code/Network/NetworkDependencies/Connection.h +++ b/Code/Network/NetworkDependencies/Connection.h @@ -16,8 +16,8 @@ namespace Oyster { public: - Connection() { this->socket = 0; }; - Connection( int socket ) { this->socket = socket; }; + Connection(); + Connection( int socket ); virtual ~Connection(); virtual int InitiateServer( unsigned short port ); @@ -39,6 +39,9 @@ namespace Oyster int socket; + bool stillSending; + bool closed; + }; } } diff --git a/Code/Network/OysterNetworkServer/ServerMain.cpp b/Code/Network/OysterNetworkServer/ServerMain.cpp index 95a07641..74584b27 100644 --- a/Code/Network/OysterNetworkServer/ServerMain.cpp +++ b/Code/Network/OysterNetworkServer/ServerMain.cpp @@ -120,7 +120,7 @@ void PrintOutMessage(ProtocolSet* set) break; case PackageType_player_pos: - cout << "ID " << set->Protocol.pPlayerPos->ID << endl; + //cout << "ID " << set->Protocol.pPlayerPos->ID << endl; for(int i = 0; i < (int)set->Protocol.pPlayerPos->nrOfFloats; i++) { cout << set->Protocol.pPlayerPos->matrix[i] << ' ';