Network is now working as udp or tcp. Next step is making the hybrid.
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user