40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
#ifndef NETWORK_DEPENDENCIES_I_CONNECTION_H
|
|
#define NETWORK_DEPENDENCIES_I_CONNECTION_H
|
|
|
|
//////////////////////////////////
|
|
// Created by Sam Svensson 2013 //
|
|
//////////////////////////////////
|
|
|
|
namespace Oyster
|
|
{
|
|
namespace Network
|
|
{
|
|
class OysterByte;
|
|
class IConnection
|
|
{
|
|
|
|
public:
|
|
|
|
//sends and recieve functions with bytearrays,
|
|
//will send to the users connection via socket
|
|
virtual int Send( OysterByte& bytes ) = 0;
|
|
virtual int Recieve( OysterByte& bytes) = 0;
|
|
|
|
//initiates sockets and address for server and client
|
|
virtual int InitiateServer( unsigned short port ) { return false; };
|
|
virtual int InitiateClient() { return false; };
|
|
|
|
//Listen function to let client connect, only used by the server
|
|
virtual int Listen() { return -1; };
|
|
|
|
//enables the client to connect with a server with use of name and port
|
|
//(servers uses Listen instead of connect)
|
|
virtual int Connect( unsigned short port, const char serverName[] ) { return false; };
|
|
|
|
//Disconnects the client or server TODO: optimize!
|
|
virtual int Disconnect() = 0;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif |