'Is there a way to check if a certain port is open on server?

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?



Solution 1:[1]

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/

Solution 2:[2]

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)

Solution 3:[3]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 pcnate
Solution 2 Michail Gede
Solution 3 bratkartoffel