More annoying socket questions


(Firestone, Mark - Technical Support) #1

Well guys, I solved my disconnect detection problem, at least for now, for
watching for killed threads.

Now i have a new one. I am reading the socket with eachbyte… like so…

@socket.each_byte do | fred|

lots of stuff

end

This works great. I want another user (on another thread) to be able to
page a user. I want it to pop up when they are sitting at a thread. All
the read methods I have tried for reading the socket basically stop
execution of the thread waiting for the next character. I have tried to use
getc as well, with the same results.

How can I get my pages to work without the user having to do something at a
prompt (like press return)? In Pascal, Wayne Conrad in his IO routines
provided me with a way of telling if there was something in the buffer, and
then reading it. Ruby doesn’t seem to do this. Failing a way to handle
that, is there any way round this?

Thanks!

Mark

NOTICE: This e-mail and any attachment(s) may contain confidential and
proprietary information of Goss International Corporation and/or its
subsidiaries and may be legally privileged. This e-mail is intended solely
for the addressee. If you are not the addressee, dissemination, copying or
other use of this e-mail or any of its content is strictly prohibited and
may be unlawful. If you are not the intended recipient please inform the
sender immediately and destroy the e-mail and any copies. All liability for
viruses is excluded to the fullest extent permitted by law. Any views
expressed in this message are those of the individual sender. No contract
may be construed by this e-mail.


(ts) #2

How can I get my pages to work without the user having to do something at a
prompt (like press return)? In Pascal, Wayne Conrad in his IO routines
provided me with a way of telling if there was something in the buffer, and
then reading it. Ruby doesn’t seem to do this. Failing a way to handle
that, is there any way round this?

Try to use IO::select if you want to know if you can read from a IO

Guy Decoux