From: "Hemant ." Date: 2006-09-05T00:29:58+09:00 Subject: problem with reading from socket ------=_Part_102158_28191451.1157383794114 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I have a issue in reading from Sockets(both TCPSockets and UNIXSockets).the problem is with following code snippets: begin > timeout(8) do > ret_data = @proxy_con.gets() > end > rescue Timeout::Error > return nil > rescue Exception => e > return nil > end The problem is, since read(or gets) from socket blocks the thread(or process), i do a timeout on it.and return nil to the client.Now the next time, the client puts some request, i put it to the socket and do a gets. So what happens is I get data for the previous request, because i guess the socket buffer was not cleared up( or whatever name people use for this). Can i use noblock on TCPSockets/UNIXSockets? I guess, its a pretty basic problem, but how do i go about solving this? ------=_Part_102158_28191451.1157383794114--