TCP侦听器中的套接字异常 [英] Socket exception in tcp listener
本文介绍了TCP侦听器中的套接字异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图运行以下代码:
listener = new TcpListener(IPAddress.Any,port: 80);
listener.Start();
socket = listener.AcceptSocket();
,但它引发以下异常:
试图访问a中的套接字权限被禁止的方式
but it throws the following exception: An attempt was made to access a socket in a way forbidden by its access permissions
可能是什么原因?
推荐答案
如果您不是管理员,则可能禁止使用1024以下的端口。请尝试使用类似8080的端口。另请参见我可以将哪个端口用于我的套接字?
It might be forbidden to use a port below 1024 if you are not Administrator. Try a port like 8080 instead. see also Which port can i use for my socket?
这篇关于TCP侦听器中的套接字异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文