cnet::Client is a threaded async udp and tcp communication client implemented for you
class Client
{
public:
OnReceiveEvent OnReceive;
OnConnectedEvent OnConnected;
OnDisconnectedEvent OnDisconnected;
private:
Address serverAddress;
bool connected = false;
std::shared_ptr<TCPSocket> tcpSocket;
std::shared_ptr<UDPSocket> udpSocket;
std::thread tcpThread;
std::thread udpThread;
};
Name | Description | Return type |
---|---|---|
Connect | Connects to the specified address | bool |
Close | Closes the client and cleans up | void |
Send | Send data to the server | bool |
GetPeerAddress | Returns the peer address of the client | cnet::Address |
GetSockAddress | Returns the client's address | cnet::Address |