# Using telnet to determin which service is running in ruby?

**URL:** <https://www.ruby-forum.com/t/using-telnet-to-determin-which-service-is-running-in-ruby/113985>\
**Category:** Ruby\
**Created:** [September 6, 2007, 9:32pm UTC](https://www.ruby-forum.com/t/using-telnet-to-determin-which-service-is-running-in-ruby/113985 "2007-09-06T21:32:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kazaam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b4bc9f/32.png) [@kazaam](https://www.ruby-forum.com/u/kazaam)\
**Post date:** [September 6, 2007, 9:32pm UTC](https://www.ruby-forum.com/t/using-telnet-to-determin-which-service-is-running-in-ruby/113985/1 "2007-09-06T21:32:06Z")

</div>

Hi,  
how can I get the servers response-message with net::telnet? Wether  
dump\_log nor output\_log are giving them. I mean if I try something like  
this just in ruby:

$(sleep 1; exit) | telnet [ubuntuforums.org](http://ubuntuforums.org) 22  
Trying 82.211.81.186…  
Connected to [ubuntuforums.org](http://ubuntuforums.org).  
Escape character is ‘^]’.  
SSH-2.0-OpenSSH\_4.6p1 Debian-5.CAT  
Connection closed by foreign host.

I get the information on this certain port is running:  
SSH-2.0-OpenSSH\_4.6p1 Debian-5.CAT.

But the net::telnet logs don’t give this information. They are just  
reporting: “Trying to connect to [ubuntuforums.org](http://ubuntuforums.org)” and “Connected to  
[ubuntuforums.org](http://ubuntuforums.org)” but not which service is running. Is there another way  
in ruby to get it?
