On Jul 5, 12:42 pm, "silverburgh.me...@gmail.com"
<silverburgh.me....RemoveThis@gmail.com> wrote:
> Hi,
>
> How can I find out if a port is available on linux?
> One thing i can do is to open() and then close() a port number.
> I wonder if there is a more efficient way?
>
> Thank you.
Run: netstat -atnp|grep LISTEN
It will show you the ports already in use. A quick way to tell if a
tcp port is free is to just 'telnet localhost XXXX' where XXXX is the
port. Connection refused means (usually) nothing is listening there.