From: Francis Cianfrocca Date: 2006-05-15T20:20:12+09:00 Subject: Re: Nonblocking socket-connect ------=_Part_66344_7224001.1147692008359 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline How about introducing the method Socket#set_nonblocking, or alternatively Socket#blocking( boolean)? A call to Socket#blocking( true ) would *explicitly* change the behavior of calls like #connect, #accept, #read and #write. It would still be possible for programmers to say: require 'fcntl' m =3D socket.fcntl(Fcntl::F_GETFL, 0) socket.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK | m) but this code would preserve the behavior that exists today. (That is, it would affect the behavior of syswrite and sysread, but not of read, write, connect, and accept). In other words, if we call Socket#nonblocking(true), the behavior of Socket#connect would change to a pure nonblocking behavior. But it would no= t break any existing code, nor would it introduce of ugly new method names (connect_nonblocking, read_nonblocking, write_nonblocking). Calling Socket#nonblocking( false ) would revert to the original behavior. On 5/14/06, Tanaka Akira wrote: > > In article <3a94cf510605140559l7baa0205le341dac4f47d424b@mail.gmail.com>, > "Francis Cianfrocca" writes: > > > All, I needed a nonblocking socket connect for my asynchronous-event > > framework, and I notice that ruby_connect blocks the calling thread wit= h > > wait_connectable. I solved my problem with this (eliding some > error-checking > > and platform-specific branches): > > > > static VALUE > > sock_connect_nonblocking (self, addr) > > VALUE self, addr; > > { > > I think it's good idea to introduce new nonblocking methods. > However no one propose a method name matz accept, yet. > -- > Tanaka Akira > > ------=_Part_66344_7224001.1147692008359--