WIP Clients are working properly, servers are not.
This commit is contained in:
@@ -1,24 +1,31 @@
|
||||
#ifndef UDPClient_h__
|
||||
#define UDPClient_h__
|
||||
|
||||
#include "Client.h"
|
||||
#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 Client
|
||||
class UDPClient : public NetworkClient
|
||||
{
|
||||
public:
|
||||
UDPClient(ConfigFile* config);
|
||||
UDPClient();
|
||||
~UDPClient();
|
||||
|
||||
void Connect(std::string playerName, std::string address, int port);
|
||||
void Disconnect();
|
||||
void Receive(Packet& packet);
|
||||
void Send(Packet & packet);
|
||||
bool IsSocketAvailable();
|
||||
private:
|
||||
// Assio UDP logic
|
||||
boost::asio::io_service m_IOService;
|
||||
boost::asio::ip::udp::endpoint m_ReceiverEndpoint;
|
||||
boost::asio::ip::udp::socket m_Socket;
|
||||
|
||||
void connect();
|
||||
void readFromServer();
|
||||
int receive(char * data);
|
||||
void send(Packet & packet);
|
||||
boost::shared_ptr<boost::asio::ip::udp::socket> m_Socket;
|
||||
int readBuffer(char* data);
|
||||
PacketID m_SendPacketID = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user