We can now send more data with UDP than previously, the splitting seems to work fine but receiving has some problems.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef UDPClient_h__
|
||||
#define UDPClient_h__
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include "Network/NetworkClient.h"
|
||||
@@ -15,18 +16,23 @@ public:
|
||||
void Connect(std::string playerName, std::string address, int port);
|
||||
void Disconnect();
|
||||
void Receive(Packet& packet);
|
||||
void Send(Packet & packet);
|
||||
void ReceivePackets();
|
||||
void Send(Packet& packet);
|
||||
void Broadcast(Packet& packet, int port);
|
||||
bool IsSocketAvailable();
|
||||
// Returns false if no packets are available
|
||||
bool GetNextPacket(Packet& packet);
|
||||
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;
|
||||
int lastReceivedSnapshotGroup = 0;
|
||||
int readBuffer();
|
||||
PacketID m_SendPacketID = 0;
|
||||
//map:(packetGroup, vector:(pair:(groupIndex, packetData)))
|
||||
std::map<unsigned int, std::vector<std::pair<unsigned int, boost::shared_ptr<char>>>> packetSegmentMap;
|
||||
std::map<unsigned int, std::vector<std::pair<int, boost::shared_ptr<char>>>> m_PacketSegmentMap;
|
||||
bool hasReceivedPacket(int packetGroup, int groupIndex);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user