私のコンピューターは、IPアドレスを自動的に取得するように構成されています。を使用するipconfig /all
と、次のように表示されます。
Windows IP Configuration
PPP adapter Broadband Connection:
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 95.38.95.204
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 0.0.0.0
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::64d7:e4ee:ba7e:1ede
IPv4 Address. . . . . . . . . . . : 192.168.72.198
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
サーバーとクライアントのIPアドレスとして95.38.95.204
またはを使用する必要がありますか?192.168.72.198
私が使用したとき192.168.72.198
、サーバーは正常に接続されましたが、クライアントはSocketException
以下のようなものを投げました
var tcpServer = new TcpClient();
tcpServer.Connect(new IpAddress("192.168.72.198"), 1986);
接続されたパーティが一定期間後に適切に応答しなかったために接続の試行が失敗したか、接続されたホストが応答しなかったために確立された接続が失敗しました192.168.72.198:1986
この記事は、geekpedia(http://www.geekpedia.com/tutorial239_Csharp-Chat-Part-1---Building-the-Chat-Client.html )で使用しました。
誰かが私を助けることができればありがとう。