Network - Starting to implement correct shutdown connection.
This commit is contained in:
parent
df1470eb2c
commit
f0dff0b728
|
@ -7,6 +7,20 @@
|
||||||
|
|
||||||
using namespace Oyster::Network;
|
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()
|
Connection::~Connection()
|
||||||
{
|
{
|
||||||
closesocket( this->socket );
|
closesocket( this->socket );
|
||||||
|
@ -30,6 +44,9 @@ int Connection::Connect(unsigned short port , const char serverName[])
|
||||||
return WSAGetLastError();
|
return WSAGetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closed = false;
|
||||||
|
stillSending = true;
|
||||||
|
|
||||||
//connection succesfull!
|
//connection succesfull!
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -63,6 +80,9 @@ int Connection::InitiateServer(unsigned short port)
|
||||||
return errorCode;
|
return errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closed = false;
|
||||||
|
stillSending = true;
|
||||||
|
|
||||||
//Server started!
|
//Server started!
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Connection() { this->socket = 0; };
|
Connection();
|
||||||
Connection( int socket ) { this->socket = socket; };
|
Connection( int socket );
|
||||||
virtual ~Connection();
|
virtual ~Connection();
|
||||||
|
|
||||||
virtual int InitiateServer( unsigned short port );
|
virtual int InitiateServer( unsigned short port );
|
||||||
|
@ -39,6 +39,9 @@ namespace Oyster
|
||||||
|
|
||||||
int socket;
|
int socket;
|
||||||
|
|
||||||
|
bool stillSending;
|
||||||
|
bool closed;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ void PrintOutMessage(ProtocolSet* set)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PackageType_player_pos:
|
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++)
|
for(int i = 0; i < (int)set->Protocol.pPlayerPos->nrOfFloats; i++)
|
||||||
{
|
{
|
||||||
cout << set->Protocol.pPlayerPos->matrix[i] << ' ';
|
cout << set->Protocol.pPlayerPos->matrix[i] << ' ';
|
||||||
|
|
Loading…
Reference in New Issue