Hanshake now has distribution_mode Removed all the undef SendMessage and redefenitions, we are undefing it in Defs.hpp and we are now defing it back Added SendHanshake GetMaxConnections SetMaxConnections and shutdown_internal methods in TcpServer.hpp and changed AcceptConnection parameter to uint16 Removed process_all_data method in VoidNetClient.hpp Placed some functions that are OS independent in main cpp files to prevent the DRY concept Fixed receive_data_array method in TcpClientWindows.cpp VoidNetClientAPI::SendMessage now checks if tags dont have the CONNECT or DISCONNECT value because thats reserved to the server
39 lines
955 B
C++
39 lines
955 B
C++
#ifndef VOID_NET_HPP
|
|
#define VOID_NET_HPP
|
|
|
|
#ifdef _MSC_VER
|
|
#pragma once
|
|
#endif
|
|
|
|
#include "Defs.hpp"
|
|
#include "Init.hpp"
|
|
#include "TcpClient.hpp"
|
|
#include "NetworkBuffer.hpp"
|
|
#include "NetworkMessage.hpp"
|
|
|
|
#include <string>
|
|
#include <thread>
|
|
|
|
struct VoidNetClientAPI
|
|
{
|
|
static bool Connect(const std::string &ip, uint16 port = default_client_port);
|
|
static void Disconnect();
|
|
|
|
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 void SendMessage(byte distribution_mode, uint16 destination_id, byte tag, byte subject, void *data);
|
|
|
|
static void Receive();
|
|
|
|
private:
|
|
static TcpClient client;
|
|
static uint16 id;
|
|
static bool receive;
|
|
};
|
|
|
|
#endif
|