Cleaned up code and fixed crash when closing client before server when using udp.
This commit is contained in:
@@ -103,9 +103,9 @@ protected:
|
||||
bool OnPlayerSpawned(const Events::PlayerSpawned& e);
|
||||
|
||||
private:
|
||||
//UDPClient m_UDPClient;
|
||||
UDPClient m_UDPClient;
|
||||
//TCPClient m_TCPClient;
|
||||
TCPClient m_UDPClient;
|
||||
//TCPClient m_UDPClient;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,17 +16,6 @@ public:
|
||||
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
|
||||
@@ -92,8 +92,8 @@ protected:
|
||||
EventRelay<Server, Events::ComponentDeleted> m_EComponentDeleted;
|
||||
bool OnComponentDeleted(const Events::ComponentDeleted& e);
|
||||
private:
|
||||
TCPServer m_TCPServer;
|
||||
//UDPServer m_UDPServer;
|
||||
//TCPServer m_TCPServer;
|
||||
UDPServer m_UDPServer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,10 +16,6 @@ public:
|
||||
void Send(Packet & packet);
|
||||
bool IsSocketAvailable();
|
||||
private:
|
||||
// Assio UDP logic
|
||||
//boost::asio::io_service m_IOService;
|
||||
//boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
||||
//boost::shared_ptr<boost::asio::ip::udp::socket> m_Socket;
|
||||
// Assio TCP logic
|
||||
boost::asio::ip::tcp::endpoint m_Endpoint;
|
||||
boost::asio::io_service m_IOService;
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include "Network/NetworkClient.h"
|
||||
//virtual void Connect(std::string address, int port) = 0;
|
||||
//virtual int Receive(char * data) = 0;
|
||||
//virtual void Send(Packet & packet) = 0;
|
||||
//virtual void Disconnect() = 0;
|
||||
|
||||
class UDPClient : public NetworkClient
|
||||
{
|
||||
|
||||
@@ -3,11 +3,6 @@
|
||||
|
||||
#include "NetworkServer.h"
|
||||
#include <boost/asio/ip/udp.hpp>
|
||||
//
|
||||
//virtual void AcceptNewConnections() = 0;
|
||||
//virtual void Receive(Packet & packet, PlayerDefinition & playerDefinition) = 0;
|
||||
//virtual void Send(Packet & packet, PlayerDefinition & playerDefinition) = 0;
|
||||
//virtual void Send(Packet & packet) = 0;
|
||||
|
||||
class UDPServer : public NetworkServer
|
||||
{
|
||||
@@ -16,7 +11,6 @@ public:
|
||||
~UDPServer();
|
||||
void AcceptNewConnections(int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers);
|
||||
void Receive(Packet & packet, PlayerDefinition & playerDefinition);
|
||||
//void parseConnect(Packet & packet, PlayerDefinition & playerDefinition);
|
||||
void Send(Packet & packet, PlayerDefinition & playerDefinition);
|
||||
void Send(Packet & packet);
|
||||
bool IsSocketAvailable();
|
||||
|
||||
Reference in New Issue
Block a user