Skip to content

Commit

Permalink
20141227
Browse files Browse the repository at this point in the history
  • Loading branch information
ldcsaa committed Dec 27, 2014
1 parent 34f9fe3 commit 975112d
Show file tree
Hide file tree
Showing 136 changed files with 1,162 additions and 373 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Compiled Object files
# Compiled Object files
*.slo
*.lo
*.o
Expand Down
7 changes: 6 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ v3.3.1
3��IPullSocket �� IPullClient �ӿ����� Peek() �������ڿ�̽���������ݣ������Ƴ����������ݣ�
4������ IComplexSocketListener �������ӿڣ����� Server/Agent ����ļ��������ӿ�
5��IComplexSocketListener �ṩ OnShutdown ֪ͨ����ȡ�� Server/Agent ���ԭ���� OnServerShutdown/OnAgentShutdown
6��IClient������� Get/SetExtra() �������ڱ����Զ��帽������
6��IClient ������� Get/SetExtra() �������ڱ����Զ��帽������
7��IServer �� IAgent ������ӡ���Ĭ���Ӵ�������ط�����
1) DisconnectSilenceConnections()���Ͽ�����ָ��ʱ���ľ�Ĭ����
2) GetSilencePeriod()����ȡij�����Ӿ�Ĭʱ�䣨���룩
3) SetMarkSilence()�������Ƿ��Ǿ�Ĭʱ�䣨����Ϊ TRUE ʱ DisconnectSilenceConnections() �� GetSilencePeriod() ����Ч��Ĭ�ϣ�FALSE��
4) IsMarkSilence()������Ƿ��Ǿ�Ĭʱ��

> ���� UdpCast ͨ�������
-----------------
Expand Down
Binary file modified Doc/HP-Socket Class Diagram - v3.3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,019 changes: 668 additions & 351 deletions Doc/HP-Socket Class Diagram - v3.3.uml

Large diffs are not rendered by default.

Binary file not shown.
25 changes: 21 additions & 4 deletions HP-Socket/Bin/HPSocket/SocketInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ class IComplexSocket
* 返回值: TRUE -- 成功
* FALSE -- 失败,可通过 Windows API 函数 ::GetLastError() 获取 Windows 错误代码
*/
virtual BOOL SendPackets(CONNID dwConnID, const WSABUF pBuffers[], int iCount) = 0;
virtual BOOL SendPackets(CONNID dwConnID, const WSABUF pBuffers[], int iCount) = 0;

/*
* 名称:断开连接
Expand All @@ -615,7 +615,7 @@ class IComplexSocket
* 返回值: TRUE -- 成功
* FALSE -- 失败
*/
virtual BOOL Disconnect(CONNID dwConnID, BOOL bForce = TRUE) = 0;
virtual BOOL Disconnect(CONNID dwConnID, BOOL bForce = TRUE) = 0;

/*
* 名称:断开超时连接
Expand All @@ -626,7 +626,18 @@ class IComplexSocket
* 返回值: TRUE -- 成功
* FALSE -- 失败
*/
virtual BOOL DisconnectLongConnections(DWORD dwPeriod, BOOL bForce = TRUE) = 0;
virtual BOOL DisconnectLongConnections(DWORD dwPeriod, BOOL bForce = TRUE) = 0;

/*
* 名称:断开静默连接
* 描述:断开超过指定时长的静默连接
*
* 参数: dwPeriod -- 时长(毫秒)
* bForce -- 是否强制断开连接
* 返回值: TRUE -- 成功
* FALSE -- 失败
*/
virtual BOOL DisconnectSilenceConnections(DWORD dwPeriod, BOOL bForce = TRUE) = 0;

public:

Expand Down Expand Up @@ -665,12 +676,14 @@ class IComplexSocket
virtual BOOL GetAllConnectionIDs (CONNID pIDs[], DWORD& dwCount) = 0;
/* 获取某个连接时长(毫秒) */
virtual BOOL GetConnectPeriod (CONNID dwConnID, DWORD& dwPeriod) = 0;
/* 获取某个连接静默时间(毫秒) */
virtual BOOL GetSilencePeriod (CONNID dwConnID, DWORD& dwPeriod) = 0;
/* 获取某个连接的远程地址信息 */
virtual BOOL GetRemoteAddress (CONNID dwConnID, TCHAR lpszAddress[], int& iAddressLen, USHORT& usPort) = 0;
/* 获取最近一次失败操作的错误代码 */
virtual EnSocketError GetLastError () = 0;
/* 获取最近一次失败操作的错误描述 */
virtual LPCTSTR GetLastErrorDesc() = 0;
virtual LPCTSTR GetLastErrorDesc () = 0;
/* 获取连接中未发出数据的长度 */
virtual BOOL GetPendingDataLength (CONNID dwConnID, int& iPending) = 0;

Expand All @@ -692,6 +705,8 @@ class IComplexSocket
virtual void SetWorkerThreadCount (DWORD dwWorkerThreadCount) = 0;
/* 设置关闭组件前等待连接关闭的最长时限(毫秒,0 则不等待) */
virtual void SetMaxShutdownWaitTime (DWORD dwMaxShutdownWaitTime) = 0;
/* 设置是否标记静默时间(设置为 TRUE 时 DisconnectSilenceConnections() 和 GetSilencePeriod() 才有效,默认:FALSE) */
virtual void SetMarkSilence (BOOL bMarkSilence) = 0;

/* 获取数据发送策略 */
virtual EnSendPolicy GetSendPolicy () = 0;
Expand All @@ -711,6 +726,8 @@ class IComplexSocket
virtual DWORD GetWorkerThreadCount () = 0;
/* 获取关闭组建前等待连接关闭的最长时限 */
virtual DWORD GetMaxShutdownWaitTime () = 0;
/* 检测是否标记静默时间 */
virtual BOOL IsMarkSilence () = 0;

public:
virtual ~IComplexSocket() {}
Expand Down
Binary file modified HP-Socket/Bin/HPSocket/x64/HPSocket.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x64/HPSocket.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x64/HPSocket_D.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x64/HPSocket_D.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x64/HPSocket_U.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x64/HPSocket_U.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x64/HPSocket_UD.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x64/HPSocket_UD.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x86/HPSocket.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x86/HPSocket.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x86/HPSocket_D.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x86/HPSocket_D.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x86/HPSocket_U.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x86/HPSocket_U.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x86/HPSocket_UD.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket/x86/HPSocket_UD.lib
Binary file not shown.
34 changes: 34 additions & 0 deletions HP-Socket/Bin/HPSocket4C/HPSocket4C.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,17 @@ HPSOCKET_API BOOL __stdcall HP_Server_Disconnect(HP_Server pServer, HP_CONNID dw
*/
HPSOCKET_API BOOL __stdcall HP_Server_DisconnectLongConnections(HP_Server pServer, DWORD dwPeriod, BOOL bForce);

/*
* 名称:断开静默连接
* 描述:断开超过指定时长的静默连接
*
* 参数: dwPeriod -- 时长(毫秒)
* bForce -- 是否强制断开连接
* 返回值: TRUE -- 成功
* FALSE -- 失败
*/
HPSOCKET_API BOOL __stdcall HP_Server_DisconnectSilenceConnections(HP_Server pServer, DWORD dwPeriod, BOOL bForce);

/******************************************************************************/
/***************************** Server 属性访问方法 *****************************/

Expand Down Expand Up @@ -504,6 +515,8 @@ HPSOCKET_API DWORD __stdcall HP_Server_GetConnectionCount(HP_Server pServer);
HPSOCKET_API BOOL __stdcall HP_Server_GetAllConnectionIDs(HP_Server pServer, HP_CONNID pIDs[], DWORD* pdwCount);
/* 获取某个客户端连接时长(毫秒) */
HPSOCKET_API BOOL __stdcall HP_Server_GetConnectPeriod(HP_Server pServer, HP_CONNID dwConnID, DWORD* pdwPeriod);
/* 获取某个连接静默时间(毫秒) */
HPSOCKET_API BOOL __stdcall HP_Server_GetSilencePeriod(HP_Server pServer, HP_CONNID dwConnID, DWORD* pdwPeriod);
/* 获取监听 Socket 的地址信息 */
HPSOCKET_API BOOL __stdcall HP_Server_GetListenAddress(HP_Server pServer, TCHAR lpszAddress[], int* piAddressLen, USHORT* pusPort);
/* 获取某个连接的远程地址信息 */
Expand All @@ -527,6 +540,8 @@ HPSOCKET_API void __stdcall HP_Server_SetFreeBufferObjHold(HP_Server pServer, DW
HPSOCKET_API void __stdcall HP_Server_SetWorkerThreadCount(HP_Server pServer, DWORD dwWorkerThreadCount);
/* 设置关闭服务前等待连接关闭的最长时限(毫秒,0 则不等待) */
HPSOCKET_API void __stdcall HP_Server_SetMaxShutdownWaitTime(HP_Server pServer, DWORD dwMaxShutdownWaitTime);
/* 设置是否标记静默时间(设置为 TRUE 时 DisconnectSilenceConnections() 和 GetSilencePeriod() 才有效,默认:FALSE) */
HPSOCKET_API void __stdcall HP_Server_SetMarkSilence(HP_Server pServer, BOOL bMarkSilence);

/* 获取数据发送策略 */
HPSOCKET_API En_HP_SendPolicy __stdcall HP_Server_GetSendPolicy(HP_Server pServer);
Expand All @@ -546,6 +561,8 @@ HPSOCKET_API DWORD __stdcall HP_Server_GetFreeBufferObjHold(HP_Server pServer);
HPSOCKET_API DWORD __stdcall HP_Server_GetWorkerThreadCount(HP_Server pServer);
/* 获取关闭服务前等待连接关闭的最长时限 */
HPSOCKET_API DWORD __stdcall HP_Server_GetMaxShutdownWaitTime(HP_Server pServer);
/* 检测是否标记静默时间 */
HPSOCKET_API BOOL __stdcall HP_Server_IsMarkSilence(HP_Server pServer);

/**********************************************************************************/
/******************************* TCP Server 操作方法 *******************************/
Expand Down Expand Up @@ -707,6 +724,17 @@ HPSOCKET_API BOOL __stdcall HP_Agent_Disconnect(HP_Agent pAgent, HP_CONNID dwCon
*/
HPSOCKET_API BOOL __stdcall HP_Agent_DisconnectLongConnections(HP_Agent pAgent, DWORD dwPeriod, BOOL bForce);

/*
* 名称:断开静默连接
* 描述:断开超过指定时长的静默连接
*
* 参数: dwPeriod -- 时长(毫秒)
* bForce -- 是否强制断开连接
* 返回值: TRUE -- 成功
* FALSE -- 失败
*/
HPSOCKET_API BOOL __stdcall HP_Agent_DisconnectSilenceConnections(HP_Agent pAgent, DWORD dwPeriod, BOOL bForce);

/******************************************************************************/
/***************************** Agent 属性访问方法 *****************************/

Expand Down Expand Up @@ -742,6 +770,8 @@ HPSOCKET_API DWORD __stdcall HP_Agent_GetConnectionCount(HP_Agent pAgent);
HPSOCKET_API BOOL __stdcall HP_Agent_GetAllConnectionIDs(HP_Agent pAgent, HP_CONNID pIDs[], DWORD* pdwCount);
/* 获取某个连接时长(毫秒) */
HPSOCKET_API BOOL __stdcall HP_Agent_GetConnectPeriod(HP_Agent pAgent, HP_CONNID dwConnID, DWORD* pdwPeriod);
/* 获取某个连接静默时间(毫秒) */
HPSOCKET_API BOOL __stdcall HP_Agent_GetSilencePeriod(HP_Agent pAgent, HP_CONNID dwConnID, DWORD* pdwPeriod);
/* 获取某个连接的本地地址信息 */
HPSOCKET_API BOOL __stdcall HP_Agent_GetLocalAddress(HP_Agent pAgent, HP_CONNID dwConnID, TCHAR lpszAddress[], int* piAddressLen, USHORT* pusPort);
/* 获取某个连接的远程地址信息 */
Expand Down Expand Up @@ -771,6 +801,8 @@ HPSOCKET_API void __stdcall HP_Agent_SetFreeBufferObjHold(HP_Agent pAgent, DWORD
HPSOCKET_API void __stdcall HP_Agent_SetWorkerThreadCount(HP_Agent pAgent, DWORD dwWorkerThreadCount);
/* 设置关闭组件前等待连接关闭的最长时限(毫秒,0 则不等待) */
HPSOCKET_API void __stdcall HP_Agent_SetMaxShutdownWaitTime(HP_Agent pAgent, DWORD dwMaxShutdownWaitTime);
/* 设置是否标记静默时间(设置为 TRUE 时 DisconnectSilenceConnections() 和 GetSilencePeriod() 才有效,默认:FALSE) */
HPSOCKET_API void __stdcall HP_Agent_SetMarkSilence(HP_Agent pAgent, BOOL bMarkSilence);

/* 获取数据发送策略 */
HPSOCKET_API En_HP_SendPolicy __stdcall HP_Agent_GetSendPolicy(HP_Agent pAgent);
Expand All @@ -790,6 +822,8 @@ HPSOCKET_API DWORD __stdcall HP_Agent_GetFreeBufferObjHold(HP_Agent pAgent);
HPSOCKET_API DWORD __stdcall HP_Agent_GetWorkerThreadCount(HP_Agent pAgent);
/* 获取关闭组件前等待连接关闭的最长时限 */
HPSOCKET_API DWORD __stdcall HP_Agent_GetMaxShutdownWaitTime(HP_Agent pAgent);
/* 检测是否标记静默时间 */
HPSOCKET_API BOOL __stdcall HP_Agent_IsMarkSilence(HP_Agent pAgent);

/**********************************************************************************/
/******************************* TCP Agent 操作方法 *******************************/
Expand Down
Binary file modified HP-Socket/Bin/HPSocket4C/x64/HPSocket4C.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x64/HPSocket4C.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x64/HPSocket4C_D.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x64/HPSocket4C_D.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x64/HPSocket4C_U.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x64/HPSocket4C_U.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x64/HPSocket4C_UD.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x64/HPSocket4C_UD.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x86/HPSocket4C.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x86/HPSocket4C.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x86/HPSocket4C_D.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x86/HPSocket4C_D.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x86/HPSocket4C_U.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x86/HPSocket4C_U.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x86/HPSocket4C_UD.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4C/x86/HPSocket4C_UD.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4CS/x64/HPSocket4C_U.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4CS/x64/HPSocketCS.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4CS/x86/HPSocket4C_U.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4CS/x86/HPSocketCS.dll
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4E/Lib/HPSocket_4C.lib
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4E/Lib/Hp_Socket.fne
Binary file not shown.
Binary file modified HP-Socket/Bin/HPSocket4E/Lib/Hp_Socket_static.lib
Binary file not shown.
Binary file modified HP-Socket/DLL/HPSocketDLL/HPSocketDLL.suo
Binary file not shown.
Binary file modified HP-Socket/DLL/HPSocketDLL4C/HPSocketDLL4C.suo
Binary file not shown.
Binary file modified HP-Socket/Demo/HttpProxy/HttpProxy.suo
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,16 @@ public class HPSocketSdk
[DllImport(SOCKET_DLL_PATH)]
public static extern bool HP_Server_DisconnectLongConnections(IntPtr pServer, uint dwPeriod, bool bForce);

/// <summary>
/// 断开超过指定时长的静默连接
/// </summary>
/// <param name="pServer"></param>
/// <param name="dwPeriod">时长(毫秒)</param>
/// <param name="bForce">是否强制断开连接</param>
/// <returns></returns>
[DllImport(SOCKET_DLL_PATH)]
public static extern bool HP_Server_DisconnectSilenceConnections(IntPtr pServer, uint dwPeriod, bool bForce);

/******************************************************************************/
/***************************** Server 属性访问方法 *****************************/

Expand Down Expand Up @@ -715,6 +725,16 @@ public class HPSocketSdk
[DllImport(SOCKET_DLL_PATH)]
public static extern bool HP_Server_GetConnectPeriod(IntPtr pServer, IntPtr dwConnId, ref uint pdwPeriod);

/// <summary>
/// 获取某个连接静默时间(毫秒)
/// </summary>
/// <param name="pServer"></param>
/// <param name="dwConnId"></param>
/// <param name="pdwPeriod"></param>
/// <returns></returns>
[DllImport(SOCKET_DLL_PATH)]
public static extern bool HP_Server_GetSilencePeriod(IntPtr pServer, IntPtr dwConnId, ref uint pdwPeriod);

/// <summary>
/// 获取监听 Socket 的地址信息
/// </summary>
Expand Down Expand Up @@ -795,6 +815,13 @@ public class HPSocketSdk
[DllImport(SOCKET_DLL_PATH)]
public static extern void HP_Server_SetMaxShutdownWaitTime(IntPtr pServer, uint dwMaxShutdownWaitTime);

/// <summary>
/// 设置是否标记静默时间(设置为 TRUE 时 DisconnectSilenceConnections() 和 GetSilencePeriod() 才有效,默认:FALSE)
/// </summary>
/// <param name="pServer"></param>
/// <param name="bMarkSilence"></param>
[DllImport(SOCKET_DLL_PATH)]
public static extern void HP_Server_SetMarkSilence(IntPtr pServer, bool bMarkSilence);

/// <summary>
/// 获取 Socket 缓存对象锁定时间
Expand Down Expand Up @@ -852,6 +879,14 @@ public class HPSocketSdk
[DllImport(SOCKET_DLL_PATH)]
public static extern uint HP_Server_GetMaxShutdownWaitTime(IntPtr pServer);

/// <summary>
/// 检测是否标记静默时间
/// </summary>
/// <param name="pServer"></param>
/// <returns></returns>
[DllImport(SOCKET_DLL_PATH)]
public static extern bool HP_Server_IsMarkSilence(IntPtr pServer);

/**********************************************************************************/
/***************************** TCP Server 操作方法 *****************************/

Expand Down Expand Up @@ -1447,6 +1482,16 @@ public class HPSocketSdk
[DllImport(SOCKET_DLL_PATH)]
public static extern bool HP_Agent_DisconnectLongConnections(IntPtr pAgent, uint dwPeriod, bool bForce);

/// <summary>
/// 断开超过指定时长的静默连接
/// </summary>
/// <param name="pServer"></param>
/// <param name="dwPeriod">时长(毫秒)</param>
/// <param name="bForce">是否强制断开连接</param>
/// <returns></returns>
[DllImport(SOCKET_DLL_PATH)]
public static extern bool HP_Agent_DisconnectSilenceConnections(IntPtr pAgent, uint dwPeriod, bool bForce);

/******************************************************************************/
/***************************** Agent 操作方法 *****************************/

Expand Down Expand Up @@ -1565,6 +1610,16 @@ public class HPSocketSdk
[DllImport(SOCKET_DLL_PATH)]
public static extern bool HP_Agent_GetConnectPeriod(IntPtr pAgent, IntPtr dwConnId, ref uint pdwPeriod);

/// <summary>
/// 获取某个连接静默时间(毫秒)
/// </summary>
/// <param name="pServer"></param>
/// <param name="dwConnId"></param>
/// <param name="pdwPeriod"></param>
/// <returns></returns>
[DllImport(SOCKET_DLL_PATH)]
public static extern bool HP_Agent_GetSilencePeriod(IntPtr pAgent, IntPtr dwConnId, ref uint pdwPeriod);

/// <summary>
/// 获取监听 Socket 的地址信息
/// </summary>
Expand Down Expand Up @@ -1670,6 +1725,14 @@ public class HPSocketSdk
[DllImport(SOCKET_DLL_PATH)]
public static extern void HP_Agent_SetMaxShutdownWaitTime(IntPtr pAgent, uint dwMaxShutdownWaitTime);

/// <summary>
/// 设置是否标记静默时间(设置为 TRUE 时 DisconnectSilenceConnections() 和 GetSilencePeriod() 才有效,默认:FALSE)
/// </summary>
/// <param name="pServer"></param>
/// <param name="bMarkSilence"></param>
[DllImport(SOCKET_DLL_PATH)]
public static extern void HP_Agent_SetMarkSilence(IntPtr pAgent, bool bMarkSilence);

/// <summary>
/// 获取 Socket 缓存对象锁定时间
/// </summary>
Expand Down Expand Up @@ -1726,6 +1789,14 @@ public class HPSocketSdk
[DllImport(SOCKET_DLL_PATH)]
public static extern uint HP_Agent_GetMaxShutdownWaitTime(IntPtr pAgent);

/// <summary>
/// 检测是否标记静默时间
/// </summary>
/// <param name="pServer"></param>
/// <returns></returns>
[DllImport(SOCKET_DLL_PATH)]
public static extern bool HP_Agent_IsMarkSilence(IntPtr pAgent);

/**********************************************************************************/
/***************************** TCP Agent 属性访问方法 *****************************/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,28 @@ public bool Disconnect(IntPtr connId, bool force = true)
return HPSocketSdk.HP_Agent_Disconnect(pAgent, connId, force);
}

/// <summary>
/// 断开超过指定时间的连接
/// </summary>
/// <param name="period">毫秒</param>
/// <param name="force">强制</param>
/// <returns></returns>
public bool DisconnectLongConnections(uint period, bool force = true)
{
return HPSocketSdk.HP_Agent_DisconnectLongConnections(pAgent, period, force);
}

/// <summary>
/// 断开超过指定时长的静默连接
/// </summary>
/// <param name="period">毫秒</param>
/// <param name="force">强制</param>
/// <returns></returns>
public bool DisconnectSilenceConnections(uint period, bool force = true)
{
return HPSocketSdk.HP_Agent_DisconnectSilenceConnections(pAgent, period, force);
}

/// <summary>
/// 设置连接的附加数据
/// </summary>
Expand Down Expand Up @@ -549,6 +571,28 @@ public bool GetRemoteAddress(IntPtr connId, ref string ip, ref ushort port)
return ret;
}

/// <summary>
/// 获取指定连接的连接时长(毫秒)
/// </summary>
/// <param name="connId"></param>
/// <param name="period"></param>
/// <returns></returns>
public bool GetConnectPeriod(IntPtr connId, ref uint period)
{
return HPSocketSdk.HP_Agent_GetConnectPeriod(pAgent, connId, ref period);
}

/// <summary>
/// 获取某个连接静默时间(毫秒)
/// </summary>
/// <param name="connId"></param>
/// <param name="period"></param>
/// <returns></returns>
public bool GetSilencePeriod(IntPtr connId, ref uint period)
{
return HPSocketSdk.HP_Agent_GetSilencePeriod(pAgent, connId, ref period);
}

///////////////////////////////////////////////////////////////////////////////////////
/// <summary>
/// 置是否启用地址重用机制(默认:不启用)
Expand Down Expand Up @@ -658,6 +702,15 @@ public void SetMaxShutdownWaitTime(uint val)
HPSocketSdk.HP_Agent_SetMaxShutdownWaitTime(pAgent, val);
}

/// <summary>
/// 设置是否标记静默时间(设置为 TRUE 时 DisconnectSilenceConnections() 和 GetSilencePeriod() 才有效,默认:FALSE)
/// </summary>
/// <param name="val"></param>
public void SetMarkSilence(bool val)
{
HPSocketSdk.HP_Agent_SetMarkSilence(pAgent, val);
}

/// <summary>
/// 获取工作线程数量
/// </summary>
Expand Down Expand Up @@ -748,6 +801,15 @@ public uint GetMaxShutdownWaitTime()
return HPSocketSdk.HP_Agent_GetMaxShutdownWaitTime(pAgent);
}

/// <summary>
/// 检测是否标记静默时间
/// </summary>
/// <returns></returns>
public bool IsMarkSilence()
{
return HPSocketSdk.HP_Agent_IsMarkSilence(pAgent);
}

/// <summary>
/// 根据错误码返回错误信息
/// </summary>
Expand Down
Loading

0 comments on commit 975112d

Please sign in to comment.