third time is the charm
fixed send and recieve functions in IConnection
This commit is contained in:
parent
89ce3dd0d1
commit
adcef51227
|
@ -101,12 +101,12 @@ void Connection::Disconnect()
|
|||
closesocket(mySocket);
|
||||
}
|
||||
|
||||
bool Connection::Send(int socket , const char message[])
|
||||
bool Connection::Send(const char message[])
|
||||
{
|
||||
int nBytes;
|
||||
unsigned long messageSize = strlen(message);
|
||||
|
||||
if((nBytes = send(socket, message , messageSize, 0)) == SOCKET_ERROR)
|
||||
if((nBytes = send(mySocket, message , messageSize, 0)) == SOCKET_ERROR)
|
||||
{
|
||||
//Send failed!
|
||||
return false;
|
||||
|
@ -115,10 +115,10 @@ bool Connection::Send(int socket , const char message[])
|
|||
return true;
|
||||
}
|
||||
|
||||
int Recieve(int socket, char message[])
|
||||
int Connection::Recieve(char message[])
|
||||
{
|
||||
int nBytes;
|
||||
nBytes = recv(socket, message , 255, 0);
|
||||
nBytes = recv(mySocket, message , 255, 0);
|
||||
if(nBytes == SOCKET_ERROR)
|
||||
{
|
||||
//Recv failed
|
||||
|
|
|
@ -20,8 +20,8 @@ class Connection : public IConnection
|
|||
virtual bool Connect( unsigned short port , const char serverName[] );
|
||||
virtual bool InitiateServer( unsigned short port );
|
||||
virtual void Disconnect();
|
||||
virtual bool Send(int socket , const char message[]);
|
||||
virtual int Recieve(int socket);
|
||||
virtual bool Send(const char message[]);
|
||||
virtual int Recieve(char message[]);
|
||||
virtual int Listen();
|
||||
};
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ class IConnection
|
|||
virtual bool Connect( unsigned short port, const char serverName[] ) = 0;
|
||||
virtual bool InitiateServer( unsigned short port ) = 0;
|
||||
virtual void Disconnect() = 0;
|
||||
virtual bool Send(int socket , const char message[]) = 0;
|
||||
virtual int Recieve( int socket ) = 0;
|
||||
virtual bool Send( const char message[] ) = 0;
|
||||
virtual int Recieve(char message[]) = 0;
|
||||
virtual int Listen() = 0;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue