From: Scott Cole Date: 2010-09-29T00:27:05+09:00 Subject: Re: TCP Socket: Connection reset, but Select says it's valid Thanks for responding. I would expect to get some kind of EOF error on an EOF condition. Instead I see something like error reading 'line' from # Connection reset by peer (Errno::ECONNRESET)! Selection is # Brian Candler wrote: > Scott Cole wrote: >> I'm running a server that sometimes encounters a >> connection-reset-by-peer error when reading data from a client. I'm >> calling IO.Select to verify that there are characters to be read, but >> occasionally the "rescue" below is activated when I do my gets. > > Your code prints the exception class and message, what do you see? > I >> presume this means the socket was closed after Select noticed there were >> characters to be read but before I actually try to read them. > > select returns true for an EOF-condition too. From `man 2 select`: > > Three independent sets of file descriptors are watched. Those > listed > in readfds will be watched to see if characters become > available for > reading (more precisely, to see if a read will not block; in > particu‐ > lar, a file descriptor is also ready on end-of-file) -- Posted via http://www.ruby-forum.com/.