Ports. Local and external?

I studied computer networks. I got into a dead end... Some suffer with closed ports, when using any programs (uTorrent, skype)

Here is an example of a pseudocode that deploys a simple tcp server:

s = socket()
s.bind('localhost', 3333)
s.listen(3)

As I understood, this code deploys the server only on the local host (?!) How then does the program establish a connection to the server? How does it forward the data?

A server that is hundreds of kilometers away will not be able to send data to the address 123.123.123.123:3333?? If ip of the client (program) is not dedicated and the provider does not allow opening ports??!

I checked that skype has no open ports on my external ip.. It turns out that there are internal and external ports??

Author: monsiure, 2016-12-27

1 answers

Some suffer with closed ports, when using any programs (uTorrent, skype)

The term "closed port" in this case is wrong.

Either the port is forbidden (the antivirus/firewall settings do not allow you to form a socket that listens to this port, i.e. accepts packets coming to this port), or it is busy (the socket that listens to this port is already formed by another process, and this is an undivided resource). However, the ban is organized exactly as busy, although the port is not really busy.

"There are no internal" and "external" ports. There is a local port (on this host) and a remote port (on the host with which the network is exchanged).

UPD: "Closed port" is when the application was able to form a listening socket, but all packets coming to this port are intercepted (and dropped) by the firewall / antivirus.

 1
Author: Akina, 2016-12-27 19:55:02