I need your help with sockets.
I read the PickAxe information on Socket on Apendix A. I also read an
article “Sockets programming in Ruby” By: M. Tim Jones. All the examples
provided worked within their context.
However, I am new to Socket programming and to Ruby but I am trying to
establish a simple connection between a TCPServer and a client.
Basically, I would like the server side to start and block itself
for a request from a client.
The client will connect and request a service such as execute a command
the servers side and return the output.
I am having heck of a time trying to get a simple sample program to
The connection is actually established, but I don’t see the string that
sent the server and I don’t get anything back on the client either.
Here is my “server”, please don’t laugh!
port = 19557
server = TCPServer.new(‘localhost’, port)
while (session = server.accept)
puts “Inside while…”
This is suppose to be the client:
streamSock = TCPSocket.new( ‘localhost’, 19557 )
streamSock.send( “Hello\n” )
str = streamSock.recv( 100 )
I am willing to read any documentation recommended.