Question

I am using netstat to display the open port, but I am wondering when a port is opened is it only when a bind() is invoked in a process, or it is already available and the bind just change its state to listen.

No correct solution

OTHER TIPS

There is a maximum number of ports in a system (depends on the OS, but in general it's 65535 or (2^16)-1), there are privileged ports (<1024) and there are non-privileged ports (>1024). Privileged ports require root permissions to use them, non-privileged allow user processes to bind. But port is considered open or used at the point when you call bind(). You can read up on sockets in general at this location.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top