-
Notifications
You must be signed in to change notification settings - Fork 0
/
vs_tcpserver.h
23 lines (17 loc) · 987 Bytes
/
vs_tcpserver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once
#if _MSC_VER >= 1900
#include "vsdatatype.h"
#include <functional>
enum VsTcpServerConnectState
{
VsTcpServerConnectState_NewConnect,
VsTcpServerConnectState_DisConnect
};
using VsTcpServerCbOnConnectState = std::function<void(VS_UINT64 socketID,const std::string &clientAddr, VsTcpServerConnectState state)>;
using VsTcpServerCbOnRcvMessage = std::function<void(VS_UINT64 socketID, VS_INT8* data,VS_UINT32 dataLen)>;
VS_HANDLE VS_DLL_EXPORT_PREFIX VsTcpServer_start(VS_UINT16 nListenPort);
VS_INT32 VS_DLL_EXPORT_PREFIX VsTcpServer_stop(VS_HANDLE serviceHandle);
void VS_DLL_EXPORT_PREFIX VsTcpServer_setDelegate(VS_HANDLE serviceHandle, VsTcpServerCbOnConnectState state, VsTcpServerCbOnRcvMessage message);
VS_INT32 VS_DLL_EXPORT_PREFIX VsTcpServer_close(VS_HANDLE serviceHandle, VS_UINT64 socketID);
VS_INT32 VS_DLL_EXPORT_PREFIX VsTcpServer_sendToClient(VS_HANDLE serviceHandle, VS_UINT64 socketID, VS_INT8*msg, VS_UINT32 msgLen);
#endif