-
Notifications
You must be signed in to change notification settings - Fork 0
/
TcpClient.h
executable file
·30 lines (25 loc) · 1.02 KB
/
TcpClient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once
#include <string>
#include <functional>
namespace blockchain {
namespace tcp {
class TcpClient {
public:
typedef std::function<void(std::string const &, TcpClient *)> MessageCallback;
typedef std::function<void(TcpClient *)> DisconnectCallback;
typedef std::function<void(TcpClient *)> ConnectCallback;
virtual void Connect(std::string, size_t port) = 0;
virtual void Disconnect() = 0;
virtual bool IsConnected() = 0;
virtual void Send(std::string const &&) = 0;
virtual void SendAndClose(std::string const &&) = 0;
virtual std::string GetRemoteAddress() = 0;
virtual size_t GetRemotePort() = 0;
virtual void SetOnMessage(MessageCallback) = 0;
virtual void SetOnDisconnect(DisconnectCallback) = 0;
virtual void SetOnConnect(ConnectCallback) = 0;
void* Data1; //Reserved for future operations
void* Data2; //Reserved for future operations
};
}
}