1

Sometimes telnet is used for testing non telnet servers such as HTTP or SMTP servers where the TELNET protocol usually stays out of the way. However, I think I have run into a case where it is in the way while debugging a TCP server. I ran

telnet localhost < data_file

And the data the server receives is different than what is in the file.

Is there either an option to telnet or a whole nother command that I can use?

If it has to be installed separately, then I don't want it. I will just do without.

4 Answers 4

7

Well, actually it's called netcat and is Not a built-in for Solaris. But you have another option if you use bash or zsh (or may be something else):

man bash:

Bash handles several filenames specially when they are  used
in redirections, as described in the following table:
  …
     /dev/tcp/host/port
          If host is a valid hostname or  Internet  address,
          and  port  is  an  integer  port number or service
          name, bash attempts to open a  TCP  connection  to
          the corresponding socket.
2
  • 1
    That is nice to know about bash and /dev/tcp. I don't see the capability of a two way connection though, but I expect this will be helpful down the road,, and for the more needy cases, I will just write my own script. Jul 6, 2011 at 14:54
  • Excelent!! Rare knowlege
    – xoid
    May 12, 2020 at 12:24
3

I guess netcat? There's a package here. But it isn't provided by Sun default. Do you have something against packages?

2
  • Yes, it is temporary until a new plan is in place for server configuration management. Right now, everything needs to stay put. Jul 6, 2011 at 14:57
  • IMHO, a well-documented list of installed packages will work just as well for management purposes. And I would say that the benefit of using the extensive GNU tools that aren't available in a base install on Solaris outweighs the benefits of using a completely base system. But that's definitely your choice to make :) Jul 6, 2011 at 14:59
3

As poige already said: You can use the /dev/tcp// device. Here is an example:

bash-3.2$ cat </dev/null >/dev/tcp/1.2.3.4/22; echo $?
0
bash-3.2$ cat </dev/null >/dev/tcp/1.2.3.4/1522; echo $?
bash: connect: Connection timed out
bash: /dev/tcp/1.2.3.4/1522: Connection timed out
1

You probably write a small bash script for this. The "timed out" message appears after TCP timeout which ich mostly set to 4 minutes. That's quite long...

0

Maybe tcpdump? But since it is obviously not important...

1
  • I guess your haven't attentively read the question.
    – poige
    Jul 6, 2011 at 14:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .