How can I check if a port of a given host is open?
I've searched the developer reference but couldn't find anything useful...
Application is written in Objective-C / Cocoa.
Thanks for your help[/QUOTE
From the terminal the "telnet" works well. For example I know port 80 is open on my computer. I can test this
telnet localhost 80
Trying ::1...
Connected to localhost.
Escape character is '^]'.
but I know port 81 is not
telnet localhost 81
Trying ::1...
telnet: connect to address ::1: Connection refused
From C. Simply try to connect() and see what you get. read the "connect"
man page. The man page tells you about the return codes returned by
connect(). if you get ECONNREFUSED then the port is not open.