[英]Using sockets in C#
I'm trying to include a network listening module in my application developed in C#. 我试图在用C#开发的应用程序中包括一个网络侦听模块。 For that I created a socket like this
为此,我创建了一个这样的套接字
IPAddress ipAd = IPAddress.Parse("192.168.1.185"); IPAddress ipAd = IPAddress.Parse(“ 192.168.1.185”);
/* Initializes the Listener */
TcpListener myList = new TcpListener(ipAd, 5027);
/* Start Listeneting at the specified port */
myList.Start();
Console.WriteLine("The server is running at port 5027...");
Console.WriteLine("The local End point is :" +
myList.LocalEndpoint);
Console.WriteLine("Waiting for a connection.....");
Socket s = myList.AcceptSocket();
Console.WriteLine("Connection accepted from " + s.RemoteEndPoint);
But I have the following error in execution: 'An attempt was made to access a socket in a way forbidden by its access permissions' 但是我在执行过程中遇到以下错误:“试图以一种其访问权限禁止的方式访问套接字”
can anyone please help me with this problem, 谁能帮我解决这个问题,
Thank you for your help. 谢谢您的帮助。
A socket error 10013 can be caused by the antivirus or firewall software. 套接字错误10013可能是由防病毒软件或防火墙软件引起的。 Basically, a needed socket connection is being denied.
基本上,所需的套接字连接被拒绝。 Socket error 10013 is a message which implies that a port is blocked and/or unreachable.
套接字错误10013是一条消息,表示端口被阻止和/或不可达。
I would suggest you to disable antivirus software and Firewall together (as a test) on the computer temporarily and try connecting and check if it works. 我建议您暂时在计算机上同时禁用防病毒软件和防火墙(作为测试),然后尝试连接并检查其是否有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.