Danbias/Code/Network/NetworkDependencies/Connection.h

42 lines
872 B
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() { this->socket = 0; };
Connection(int socket) { this->socket = socket; };
virtual ~Connection();
virtual bool InitiateServer( unsigned short port );
virtual bool InitiateClient();
virtual bool Send( OysterByte& bytes );
virtual int Recieve( OysterByte& bytes );
virtual void Disconnect();
virtual bool Connect( unsigned short port , const char serverName[] );
virtual int Listen();
private:
2013-11-25 14:03:32 +01:00
bool initiateSocket();
int socket;
};
}
}
2013-11-19 12:38:13 +01:00
#endif