TcpClient and TcpServer are now structs intead of classes Starting with UdpClient Added 2 new methods to StringConverter: Split and Trim ConfigReader: Changed ReadNodes return type to void, parameter of operator [] is now a std::string Starting with the VoidNetServer class which is an all in one for Tcp and Udp Finally implemented the methods for the ConfigReader
40 lines
967 B
C++
40 lines
967 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 void receive_data();
|
|
|
|
static TcpClient tcp_client;
|
|
static uint16 id;
|
|
};
|
|
|
|
#endif
|