Danbias/Code/Network/NetworkDependencies/Connection.h

49 lines
1.0 KiB
C
Raw Normal View History

#ifndef NETWORK_DEPENDENCIES_CONNECTION_H
#define NETWORK_DEPENDENCIES_CONNECTION_H
2013-11-19 12:38:13 +01:00
//////////////////////////////////
// Created by Sam Svensson 2013 //
//////////////////////////////////
#include "IConnection.h"
#include "../NetworkDependencies/OysterByte.h"
2013-11-19 12:38:13 +01:00
namespace Oyster
2013-11-19 12:38:13 +01:00
{
namespace Network
{
class Connection : public IConnection
{
public:
Connection();
Connection( int socket );
virtual ~Connection();
2013-11-26 13:45:03 +01:00
virtual int InitiateServer( unsigned short port );
virtual int InitiateClient();
virtual int Send( Utility::DynamicMemory::SmartPointer<OysterByte> &bytes );
virtual int Recieve( Utility::DynamicMemory::SmartPointer<OysterByte> &bytes );
2013-11-26 13:45:03 +01:00
virtual int Disconnect();
virtual int Connect( unsigned short port , const char serverName[] );
2013-11-29 09:18:58 +01:00
virtual int Listen();
//Setting the socket to blocking/non-blocking mode.
int SetBlockingMode( bool blocking );
private:
2013-11-27 11:28:11 +01:00
int InitiateSocket();
2013-11-25 14:03:32 +01:00
int socket;
bool stillSending;
bool closed;
};
}
}
2013-11-19 12:38:13 +01:00
#endif