[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Help with Socket (TCPServer) requested!

Marcin Raczkowski

9/9/2007 8:53:00 PM


>
>
> This is suppose to be the client:
>
> require 'socket'
> streamSock = TCPSocket.new( 'localhost', 19557 )
>
> streamSock.send( "Hello\n" )
> str = streamSock.recv( 100 )
> print str
> streamSock.close
>
> I am willing to read any documentation recommended.
>
> Thank you
>

i understand that server should send some data to client? if that's the
case then:

> while (session = server.accept)
> puts "Inside while..."
> puts session.to_s # what this line actually does? o_O probably want
to do something like this:
session.write("100 character long array")
> session.close
> end

also sing something else then recv on client end is good idea