DEV Community

Henrique Holtz
Henrique Holtz

Posted on

1

How to do "ping" with a specific target-port

In this article we'll shortly see how to do ping against a host or IP but pointing a specific port.

It can be very useful to see if your container/application is alive, for example.


Using Powershell (windows)

We can use the Test-NetConnection function passing the port as a parameter, for example:

 Test-NetConnection <host-or-ip> -port <target-port>
Enter fullscreen mode Exit fullscreen mode

Using cURL

With cURL is untill simplier, just type curl <host-or-ip>:<target-port>. Example:

curl 127.0.0.1:1433
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
jlcfly profile image
Joe Clark

If you have telnet installed, telnet <host-or-ip> <port>

Collapse
 
vladignatyev profile image
Vladimir Ignatev

Notice the netcat too:

nc -zv [target-ip] [port]

Not sure if it's available on Windows

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay