From: student_vienna@... (daniel) Date: 2003-05-07T21:57:45+09:00 Subject: Re: disable buffering on sockets > Probably gets is waiting for a linefeed to return the data. I know, but when I'm using read instead of gets, read returns all the strings when I close the socket because buffering is enabled. I want to disable buffering so that ``readå¹¹ retrieved immediately the data. some code... -- while $bThreadEnd == false sleep(0.100) nsock = select($socks, nil, nil, 0); next if nsock == nil for s in nsock[0] if s == $srv ns = s.accept ns.sync= true ns.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) $socks.push(ns) c = RClient.new ns $clis.push c elsif s.eof? handle_cli_close( s ) s.close $socks.delete(s) else str = s.gets; #s.read #trace sprintf("[srv_thread] -> get telegram [%s]", str.sub("\n","")) cmd = RCmd.new(str) if cmd.iserror == true trace "[THREAD] -> incorrect telegram received" next end next if handle_cmd(s, cmd)==true # pre-handle commands $clis.each { |a| if( a.getsock == s ) a.recv cmd break end } end end end -- daniel