Re: /dev/tcp
Richard Kettlewell <[email protected]>
| Newsgroups | comp.os.linux.misc |
|---|---|
| Organization | terraraq NNTP server |
| Message-ID | <[email protected]> |
Lawrence D’Oliveiro <[email protected]> writes: > Lars Poulsen wrote: >> After several days, we have now ascertained that nobody ever >> implemented this with a true device interface - it is a fiction >> implemented by the shell intercepting the filename and diverting it. >> >> Which is kinda strange. It seems like it should be easier to really >> do it as a true device interface. It would be easier for >> quick-and-dirty programs than the socket interface. > > Plan9 did something like this at the kernel level. Not really. The Plan9 network API is more file-based than the sockets API, but it’s not particularly similar the hostname-in-filename model offered by Bash. Rather it is, roughly speaking, the sockets API rephrased as open()/read()/write(). For example to create a connection, socket() would be replaced by open("/net/tcp/clone") and connect() would be replaced by write(fd, "connect address!port"). See https://9p.io/magic/man2html/3/ip for details. -- https://www.greenend.org.uk/rjk/