Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #90180

Re: /dev/tcp

From Eli the Bearded <*@eli.users.panix.com>
Newsgroups comp.os.linux.misc
Subject Re: /dev/tcp
Date 2026-08-20 00:59 +0000
Organization Some absurd concept
Message-ID <eli$2608192059@qaz.wtf> (permalink)
References <eli$2608191720@qaz.wtf> <1165f0v$3286n$6@dont-email.me>

Show all headers | View raw


In comp.os.linux.misc, Lawrence DOliveiro <ldo@nz.invalid> wrote:
> On Wed, 19 Aug 2026 21:20:56 -0000 (UTC), Eli the Bearded wrote:
>> What system(s) have /dev/tcp/* natively?
> Not sure what the point of it is, when you have this
> <https://manpages.debian.org/socat(1)>.

This came up in the context of "how to test network on a system with no
root and no helpful utilities installed."

Normally I use, in preferential order: telnet, nc, perl[*], then curl to
test arbitrary sockets. If I know it runs a webserver, curl will be
first. In this case none of those were installed, and someone came up
with a jshell solution. Bash sockets were discussed, but also ruled out
because bash was not installed.

With jshell, the Java shell, something like this will print "Worked"
if it works:

  var s=new java.net.Socket();
  s.connect(new java.net.InetSocketAddress("www.google.com", 80), 3000);
  System.out.println("Worked");
  s.close();

And if it doesn't work, you get something like:

  |  Exception java.net.SocketTimeoutException: Connect timed out
  |        at NioSocketImpl.timedFinishConnect (NioSocketImpl.java:551)
  |        at NioSocketImpl.connect (NioSocketImpl.java:602)
  |        at SocksSocketImpl.connect (SocksSocketImpl.java:327)
  |        at Socket.connect (Socket.java:633)
  |        at (#2:1)

I was curious if there exist systems where any process that can open
a file (eg, /bin/sh) could use /dev/tcp to test sockets. I don't have
a real need, just a burning curiosity.

Elijah
------
[*] knows you can use python, too, but doesn't have the code to do so memorized

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

/dev/tcp Eli the Bearded <*@eli.users.panix.com> - 2026-08-19 21:20 +0000
  Re: /dev/tcp Richard Kettlewell <invalid@invalid.invalid> - 2026-08-19 23:53 +0100
  Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-19 23:42 +0000
    Re: /dev/tcp Eli the Bearded <*@eli.users.panix.com> - 2026-08-20 00:59 +0000
      Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-20 03:59 +0000
        Re: /dev/tcp Nuno Silva <nunojsilva@invalid.invalid> - 2026-08-20 10:10 +0100
        Re: /dev/tcp Eli the Bearded <*@eli.users.panix.com> - 2026-08-20 18:15 +0000
          Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-20 23:30 +0000
            Re: /dev/tcp Nuno Silva <nunojsilva@invalid.invalid> - 2026-08-21 01:18 +0100
            Re: /dev/tcp Marc Haber <mh+usenetspam2616@zugschl.us> - 2026-08-21 09:52 +0200
              Re: /dev/tcp Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-08-21 08:12 +0000
                Re: /dev/tcp Marc Haber <mh+usenetspam2616@zugschl.us> - 2026-08-21 11:16 +0200
  Re: /dev/tcp Rich <rich@example.invalid> - 2026-08-20 13:50 +0000
    Re: /dev/tcp c186282 <c186282@nnada.net> - 2026-08-20 13:02 -0400
      Re: /dev/tcp Rich <rich@example.invalid> - 2026-08-20 18:26 +0000
      Re: /dev/tcp The Natural Philosopher <tnp@invalid.invalid> - 2026-08-21 13:54 +0100
      Re: /dev/tcp Geoff Clare <geoff@clare.See-My-Signature.invalid> - 2026-08-21 13:41 +0100
    Re: /dev/tcp Eli the Bearded <*@eli.users.panix.com> - 2026-08-20 18:22 +0000
      Re: /dev/tcp The Natural Philosopher <tnp@invalid.invalid> - 2026-08-21 13:57 +0100

csiph-web