My computer is configured to automatically obtain IP address. When I use ipconfig /all, it shows something like below:
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
Should I use 95.38.95.204 or 192.168.72.198 as IP address for server and client?
When I used 192.168.72.198, server connected successfully but client threw an SocketException like below
var tcpServer = new TcpClient();
tcpServer.Connect(new IpAddress("192.168.72.198"), 1986);
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.72.198:1986
I used this articles on geekpedia at http://www.geekpedia.com/tutorial239_Csharp-Chat-Part-1—Building-the-Chat-Client.html
Thanks if anybody can help me.
If you are testing it on your own computer you can use
127.0.0.1or"localhost".You should use the IPv4 address generally (
192.168.72.198).It sounds like you don’t have your server already running on that socket.