Got async methods working for send in TcpClientWindows

All SendMessage functions are now void
This commit is contained in:
xX-TheDoctor-Xx
2016-07-18 20:05:22 +01:00
parent f3d090e08c
commit a1249ab5e9
11 changed files with 29 additions and 46 deletions

View File

@ -30,20 +30,15 @@ public:
NetworkBuffer ReceiveDataArray();
const NetworkMessage &ReceiveData();
void StartSender();
VoidCode SendMessage(const NetworkMessage &message);
void SendMessage(const NetworkMessage &message);
private:
void SendNetworkMessage(const NetworkMessage &message);
void SendNetworkMessageNow(const NetworkMessage &message);
static void SendNetworkMessage(const NetworkMessage &message, TcpClient *client);
VoidCode Initialize(const std::string &ip, uint16 port = default_port);
std::string ip;
uint16 port = 0;
bool initialized = false;
bool run_sender = false;
std::vector<NetworkMessage> network_message_queue;
#ifdef _MSC_VER
SOCKET tcp_socket = INVALID_SOCKET;

View File

@ -22,13 +22,13 @@ struct VoidNetClientAPI
static bool Connect(const std::string &ip, uint16 port = default_port);
static void Disconnect();
static bool SendMessageToServer(byte tag, byte subject, void *data);
static bool SendMessageToID(uint16 id, byte tag, byte subject, void *data);
static bool SendMessageToOthers(byte tag, byte subject, void *data);
static bool SendMessageToAll(byte tag, byte subject, void *data);
static bool SendMessageToAllAndMe(byte tag, byte subject, void *data);
static void SendMessageToServer(byte tag, byte subject, void *data);
static void SendMessageToID(uint16 id, byte tag, byte subject, void *data);
static void SendMessageToOthers(byte tag, byte subject, void *data);
static void SendMessageToAll(byte tag, byte subject, void *data);
static void SendMessageToAllAndMe(byte tag, byte subject, void *data);
static bool SendMessage(byte distribution_mode, uint16 destination_id, byte tag, byte subject, void *data);
static void SendMessage(byte distribution_mode, uint16 destination_id, byte tag, byte subject, void *data);
static void Receive();