Network - Starting to implement correct shutdown connection.
This commit is contained in:
parent
df1470eb2c
commit
f0dff0b728
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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] << ' ';
|
||||
|
|
Loading…
Reference in New Issue