curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Use curl to check the status/availability of local/remote port(s).

From: Daniel Stenberg via curl-users <>
Date: Mon, 11 Jan 2021 22:25:01 +0100 (CET)

On Mon, 11 Jan 2021, Hongyi Zhao via curl-users wrote:

> Say, for checking the availability of telnet server, I can use nc as
> follows:
> $ nc -z hostIP 23
> But I want to know if I can do the same job with curl too.

You *can* but it won't be as convenient:

Is there a SSH port listening?

$ curl --http0.9 --connect-timeout 3 localhost:22 -s -o /dev/null
$ echo $?


Is there a TELNET port listening?

$ curl --http0.9 --connect-timeout 3 localhost:23 -s -o /dev/null
$ echo $?


  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
Received on 2021-01-11