Network - Starting to implement correct shutdown connection.

This commit is contained in:
Pontus Fransson 2013-12-04 12:41:25 +01:00
parent df1470eb2c
commit f0dff0b728
3 changed files with 26 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;
};
}
}

View File

@ -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] << ' ';