[英]Using sockets in C#
我試圖在用C#開發的應用程序中包括一個網絡偵聽模塊。 為此,我創建了一個這樣的套接字
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);
但是我在執行過程中遇到以下錯誤:“試圖以一種其訪問權限禁止的方式訪問套接字”
誰能幫我解決這個問題,
謝謝您的幫助。
套接字錯誤10013可能是由防病毒軟件或防火牆軟件引起的。 基本上,所需的套接字連接被拒絕。 套接字錯誤10013是一條消息,表示端口被阻止和/或不可達。
我建議您暫時在計算機上同時禁用防病毒軟件和防火牆(作為測試),然后嘗試連接並檢查其是否有效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.