svn commit: r279603 - in head: bin/rcp usr.bin/rlogin usr.bin/rsh

David Chisnall theraven at FreeBSD.org
Thu Mar 5 13:27:31 UTC 2015


On 5 Mar 2015, at 13:14, Slawa Olhovchenkov <slw at zxy.spb.ru> wrote:
> 
> In previos message -- silently return when telnet speak about used IP
> address and diagnostic messages. One simple command do many diagnostic
> information.

Okay, so check the return code.  Or pass -v if you want more verbose information:

$ nc -v foo.example.com 80
nc: getaddrinfo: nodename nor servname provided, or not known
$ nc -v localhost 80
nc: connectx to localhost port 80 (tcp) failed: Connection refused
nc: connectx to localhost port 80 (tcp) failed: Connection refused
nc: connectx to localhost port 80 (tcp) failed: Connection refused

Or even alias nc -v to telnet if you like typing more...

Or add -D, if you want more debugging information.

> I am know only about telnet can connect to unix socket.

So can cat...  Actually, so can nc if you read the man page (which, of course, you did before deciding that it couldn't do what you needed).  With -U, it will connect to a UNIX domain socket.  Oh, and it can also create UNIX sockets for listening to:

$ nc -l -U tmp 
$ # in another terminal:
$ nc -U tmp

And now you have two nc instances talking to each other via a UNIX socket.



> Why not? And why before this is will be ok?

Telnet is in the base system because, back in the 4BSD days, telnet was the recommended way that you logged into remote computers.  Now it isn't.  For most network diagnostic and simple socket operations, nc is a far more useful tool.  Including things that want to talk to UNIX sockets.

David



More information about the svn-src-head mailing list