From: Derek Smith Date: 2010-04-02T09:49:42+09:00 Subject: Re: socket programming...lsof? Eric Wong > > You may also want to give '127.0.0.1' a try if you're sure that port is > listening. IIRC, some newer Linux systems favor IPv6 addresses over > IPv4 ones. OK cool thank you! What if I want to see any data passing over that port, 113 or any other port? Any adjustments in this code? SSH port 22 seems to work, well sort of. When connections come in, shouldn't I see some type of encryption strings? env ruby -w require 'socket' host = 'localhost' port = 22 # s = TCPSocket.open(host, port) while line = s.gets # Read lines from the socket puts line.chop # And print with platform line terminator end s.close # Close the socket when done derek@vaio-ubuntu:~$ sudo ruby port_tst.rb SSH-2.0-OpenSSH_5.1p1 Debian-5ubuntu1 -- Posted via http://www.ruby-forum.com/.