Hi,

On Wed, Jul 08, 2026 at 01:47:36PM -0400, Stefan Monnier wrote:
> FWIW, I tried `nc` for that (because I like `nc` for actual transfers)
> but didn't like it because it doesn't give enough feedback.  I just
> tried `socat` and it similarly just "sits there" sometimes, at which
> point I have to use my head to try and guess if it means it successfully
> connected but the other end doesn't send anything, or if it means it's
> still waiting for the connection to be established, etc...

I've never really had a problem with "nc -zv example.com 25" or
whatever. Except for remembering to use it. 😀

Some text-based protocols don't send any banner unless you send them
something first, so then I'd have to omit the -z.

> I think what I'd want is a UI a bit more like `ping`: I give it
> a hostname and a port, and it tells me when it starts to try and
> establish the connection (showing the IP address used), and then telling
> me whether the connection was successful or not (even better if it can
> show me the first few bytes received from the server, if any, but it
> should disconnect automatically) or whether it timedout.
> 
> Any recommendation?

You can put a timeout on nc, like:

$ nc -w 1 -v mail.bitfolk.com 25
Connection to mail.bitfolk.com (85.119.80.223) 25 port [tcp/smtp] succeeded!
220 mail.bitfolk.com ESMTP Exim v4.something Wed, 08 Jul 2026 17:56:31 +0000

(it closed the connection by itself)

but again, sometimes services won't say anything unless you talk first,
so you'd get 1 second of nothing.

A traceroute using TCP is also sometimes useful to find *where* the
packets die, in case of possible firewalling.

Thanks,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting

<Ging> i stopped taking my medication long ago. the ironey is it was for
  social anxioty disorder and now i daren't go back to the doctor to get
  another perscription

Reply via email to