How to test a connection without telnet? [closed]
Solution 1:
iirc, telnet isn't installed by default on centos 6 machines anymore. if you don't have tools like telnet
or nc
available you can always talk to a network socket using python. (not sure if this fits your "convenient" requirement though... )
to simply test if the connection can be established:
[gryphius@ut ~]$ python
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> conn=socket.create_connection(('gmail-smtp-in.l.google.com',25))
If that didn't throw an error so far the connection is ok. If you also want to test receiving/sending data, you could continue like this:
>>> input=conn.makefile()
>>> print input.readline()
220 mx.google.com ESMTP p2si6911139eeg.7 - gsmtp
>>> conn.sendall('HELO example.com\r\n')
>>> print input.readline()
250 mx.google.com at your service
>>> conn.sendall('QUIT')
>>> conn.close()
>>>
Solution 2:
Any of: nc (netcat), nmap, hping.
http://linux.byexamples.com/archives/258/when-netcat-act-as-telnet-client-it-becomes-better/
http://nmap.org/
http://www.hping.org/