Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i m getting error "An exception of type 'System.Net.Sockets.SocketException' occurred in System.dll but was not handled in user code Additional information: A socket operation was attempted to an unreachable network"
on
this.client = new TcpClient(""+this.myip, this.myport);
Posted
Comments
Kornfeld Eliyahu Peter 10-Dec-14 7:00am    
The error tells you that the ip/port combination can not be reached - try to see (with ping maybe or telnet) why...

1 solution

The constructor you are using there is expecting a hostname and a port. It looks like you are trying to use an IP address as the hostname.

Try this (presuming myip is of type IPAddress):

new TcpClient(new IPEndPoint(this.myip, this.myport));
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900