Hi,

I have this following code that able to make connection and then
disconnect. But after doing connection, i wish to receive data before
doing disconnect. Im very new to understand socket programming will be
great to get some help here.

require 'socket'
streamSock = Socket::new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
myaddr = [Socket::AF_INET, 5555, 113, 129, 2, 162, 0,
0].pack("snCCCCNN")
print "connecting...\n"
streamSock.connect( myaddr )
print "connected\n"

# How to read/receive data ( sample code example will help )

print "disconnecting...\n"
streamSock.close
print "disconnected\n"
-- 
Posted via http://www.ruby-forum.com/.