C#socket 心跳检测

gaobinbin001 2015-02-28 04:27:02
while (m_bAccpectWaiting)
{
//心跳检测
try
{
uint dummy = 0;
byte[] inOptionValues = new byte[Marshal.SizeOf(dummy) * 3];
BitConverter.GetBytes((uint)1).CopyTo(inOptionValues, 0);
BitConverter.GetBytes((uint)5000).CopyTo(inOptionValues, Marshal.SizeOf(dummy));
BitConverter.GetBytes((uint)5000).CopyTo(inOptionValues, Marshal.SizeOf(dummy) * 2);
m_StationSocket.IOControl(IOControlCode.KeepAliveValues, inOptionValues, null);
//接收信息
StationReciveMessage(m_StationSocket);
}
catch
{
MessageBox.Show("dd");
}
不管用呀 ,怎么它不发检测呀
...全文
534 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sunny5816 2015-03-05
  • 打赏
  • 举报
回复
可以参考一下英国的networkcomms2.3.1开源通信框架,c#语言的,好像挺不错的
mwp 2015-03-02
  • 打赏
  • 举报
回复
它是在网络层实现的,你是接收不到任何字节数据的,但是如果你接一个示波器的话应该能看到。

111,097

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧