On 9/19/06, hemant <gethemant / gmail.com> wrote:
> I have following code, the problem is, when i start a connection to
> the socket through telnet,  the data send by the server i get as
> usual, but when i try to do the same through ruby code, the data send
> by the server won't come to the client..until the server is shutdown.
>
>

Two points:
First, if you're connecting to this program using telnet, the behavior
will depend on the platform that you run telnet on. The telnet client
on Windows sends data byte-by-byte as you type it in. On Linux, Mac or
other Unix, telnet buffers the data line by line.

Second, and extremely important: you do *not* need to spin a thread to
send your data. The whole point of EventMachine is that it allows you
to handle many connections at once, without using threads. Threads
slow your program down and make it harder to debug.

If you really want to hammer your telnet client with random data based
on @local_symbols, use EventMachine#add_periodic_timer rather than
spinning a thread.