我一直在不斷收到此錯誤,並且我相信我已將自己的問題縮小到了我在64位計算機上的using a 32-bit偵聽器。有沒有什麼辦法讓它在64位系統上運行?傳遞給套接字偵聽器的參數無效
18 Socket sListener;
...
34 permission = new SocketPermission(NetworkAccess.Accept, TransportType.Tcp, "", SocketPermission.AllPorts);
36 //Listening Socket object
37 sListener = null;
39 //Ensure the code has permission to access the Socket
40 permission.Demand();
42 IPHostEntry ipHost = Dns.GetHostEntry("");
43 IPAddress ipAddress = ipHost.AddressList[2];
44 ipEndPoint = new IPEndPoint(ipAddress, 4510);
46 sListener = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
...
71 sListener.Listen(10);
72
73 //Begins an asynchronous operation to accept an attempt
74 AsyncCallback aCallback = new AsyncCallback(AcceptCallback);
75 sListener.BeginAccept(aCallback, sListener);
我試圖按照此relevant問題的代碼,但它給我的錯誤:
Operator '==' cannot be applied to operands of type 'System.Net.Sockets.AddressFamily' and 'string'
,AddressFamily是一個枚舉。嘗試'== AddressFamily.InterNetwork'而不是== == InterNetwork「' – 2013-04-23 13:10:39
在你的相關問題得到了代碼中的錯誤的任何代碼 – Geoff 2013-04-23 13:10:41