[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Socket#gets and Socket#puts

James Gray

11/25/2004 2:42:00 AM

We really ought to think about documenting the Socket class tree. :)

Okay, I'm learning with a little "Trial by Fire" over here. I'm
building a threaded server. I'm using Socket#gets for reading and
that's going fine. I've learned that it returns nil, when the
connection is closed. Does it throw exceptions under any conditions
and if so, which ones?

What about Socket#puts? If it's waiting to send something, what
happens if the connection is closed? Should I expect any exceptions on
this end of the equation?

Thanks.

James Edward Gray II



1 Answer

James Gray

11/25/2004 3:00:00 AM

0

On Nov 24, 2004, at 8:42 PM, James Edward Gray II wrote:

> Okay, I'm learning with a little "Trial by Fire" over here. I'm
> building a threaded server. I'm using Socket#gets for reading and
> that's going fine. I've learned that it returns nil, when the
> connection is closed. Does it throw exceptions under any conditions
> and if so, which ones?

Solving a little of my own puzzle here, Socket#gets and Socket#close
both throw IOError, if the Sockect is already closed.

James Edward Gray II