Network is now working as udp or tcp. Next step is making the hybrid.

This commit is contained in:
Jocke
2016-02-09 19:14:56 +01:00
parent fccd8c64e7
commit d2ed293183
12 changed files with 225 additions and 190 deletions
+20 -8
View File
@@ -1,20 +1,32 @@
#ifndef NetworkServer_h__
#define NetworkServer_h__
#include <boost/asio.hpp>
#include "Network/Packet.h"
#include "Network/PlayerDefinition.h"
#define BUFFERSIZE 32000
typedef unsigned int PlayerID;
typedef unsigned int PacketID;
class NetworkServer
{
//public:
// virtual void Connect(std::string playerName, std::string address, int port) = 0;
// virtual void Disconnect() = 0;
// virtual Packet Receive() = 0;
// virtual void Send(Packet & packet) = 0;
//protected:
// char m_ReadBuffer[BUFFERSIZE] = { 0 };
public:
virtual void AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers) = 0;
virtual void Receive(Packet & packet, PlayerDefinition & playerDefinition) = 0;
virtual void Send(Packet & packet, PlayerDefinition & playerDefinition) = 0;
virtual void Send(Packet & packet) = 0;
protected:
char m_ReadBuffer[BUFFERSIZE] = { 0 };
//void handle_accept(boost::shared_ptr<boost::asio::ip::tcp::socket> socket, const boost::system::error_code & error);
//void parseConnect(Packet & packet);
//void readFromClients();
//public:
// virtual void Connect(std::string playerName, std::string address, int port) = 0;
// virtual void Disconnect() = 0;
// virtual Packet Receive() = 0;
// virtual void Send(Packet & packet) = 0;
//protected:
// char m_ReadBuffer[BUFFERSIZE] = { 0 };
};
#endif