停止TcpListener [英] Stop TcpListener

查看:203
本文介绍了停止TcpListener的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我创建了TcpListener。

   socket = listener.AcceptSocket();
                    socket.SetSocketOption(SocketOptionLevel.Socket,SocketOptionName.ReuseAddress,false);

当收到任何消息时,它的工作正常。

但是首先启动监听器,我突然想要停止监听器抛出错误。

"通过调用WSACancelBlockingCall来中断阻塞操作"

如何无误地阻止监听器。
提前致谢

Kalees

解决方案

你很久以前就有同样的问题了。看看我的这个帖子。

http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/7ffeef71-8978-41c9-9787-6d74e1326700

ETS

Hi ,

I created TcpListener.

   socket = listener.AcceptSocket();
                    socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false);

Its working fine when any messages received.

But first start the Listener , suddenly i want stop the listener its throwing the error.

"A blocking operation was interrupted by a call to WSACancelBlockingCall"

How to stop the listener without error.

Thanks in Advance

Kalees

解决方案

Hi

i had the same issue not so long ago. have a look at this thread of mine.

http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/7ffeef71-8978-41c9-9787-6d74e1326700

Ets


这篇关于停止TcpListener的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆