Click here to Skip to main content
15,665,276 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have built program (hpro) there is check for updates button when user press, button sends request to server program and then tcp listener is starting in hpro. When server program gets request its starting to connect and then send like this:

scks.Connect(_IPAddr, _Port);

im getting _IPAddr and _Port when this server program gets request like this :

var parts = _ipPort.Split(':');
 _IPAddr = IPAddress.Parse(parts[0]);
_Port = Convert.ToInt32(parts[1]);

Visual studio gives error on this line >>> scks.Connect(_IPAddr, _Port); That cannot establish connection.

I used another port(999) which is opened to that machine where hpro is running and everything was fine

So if port is open for send does it possible to be closed for receive?

Can anyone help me?


Are you sure the port is open in the firewall?
Share this answer
To establish a connection:
- the address you are trying to connect to must be visible. Is it correct? (If another port on the same address works, this is probably not the issue.)
- a server must be running on the port you specify. Did you start a server that listens on the port you are trying to connect to?
- firewall considerations: the port must be open for outgoing connections on the client machine, and it must be open for listening on the server machine. Under a modern OS you typically have to set exceptions to allow this; did you open the port on both machines?
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