From: tammy roberts2 Date: 2012-08-21T22:17:02+09:00 Subject: Re: TCPserver how to signal EOT > Aha. The issue with that is that you can read only with one thread at > a time from the socket. Since you created a thread after socket > accept and that thread loops reading this should be the only thread > fetching data from the socket. Sending is a different story (but btw. > you should also properly synchronize to make sure only one thread > writes at a time). Please correct me if I am wrong, but shouldn't there be no problem as the yield is inside the thread itself? It seems like the listen method can not pass the socket to the caller until it is done reading from it. > No. Method #listen does not yield. It's the reader thread which you > start in #listen. And note that this can be a problem if the block > you pass in is not prepared to be executed concurrently. Ah good observation. That makes it seem like the first issue you point out will not come into play though, because the reader thread in listen is what yields the socket so it seems it will not yield it until it is done reading from it. Am I maybe misunderstanding something here? I am going to switch my code to read and write as per your suggestion. I notice that these methods do not seem to be documented in the Ruby socket documentation, could you maybe point me towards some documentation regarding them please? I will post my networking code once more when it is finished up, again thanks for the tips and advice. -- Posted via http://www.ruby-forum.com/.