Socket#gets and Socket#puts

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

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

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

···

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?