Reputation: 1003
Just as you'd ping
an IP of to a server to check if it is up, can we also check if, on that running server, a port is active/open?
this just comes from my head,but can you be more specific in your ping
statement?
`ping 127.0.0.1:7004`
I know this command is not allowed, but is there a way to check for this in Linux and Windows?
Upvotes: 8
Views: 39945
Reputation: 41
As telnet is disabled by most corporate customers, i found that powershell command on windows machines for TCP quite useful:
New-Object System.Net.Sockets.TcpClient("server", port)
Upvotes: 3
Reputation: 1177
For TCP-Ports you can simple use telnet
or nc
to establish a connection. If it succeeds, the port is open.
But as UDP is stateless you cannot check that simple for an open port. You have to know which service is behind this port and know how to send a valid packet so you get an answer.
Upvotes: 0
Reputation: 13364
That depends upon your access to system (client or server), You can use either of two options,
netstat -an
to check which ports are listeningtelnet host port
, if it is not working on linux machines try telnet host:port
.Upvotes: 6
Reputation: 1774
If you are willing and able to install software, you can use nmap
nmap -p 7004 127.0.0.1
Or if it is internet facing, use a web service such as http://www.yougetsignal.com/tools/open-ports/
Upvotes: 9