Socket#gets and Socket#puts

  • Thread starter James Edward Gray II
  • Start date
J

James Edward Gray II

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
 
J

James Edward Gray II

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top