Eric Wong <normalperson / yhbt.net> wrote:
> Proposed API would be:
> 
>    TCPSocket.new(remote_host, remote_port,
> 		 connect_timeout: 0.5, local_host: nil, local_port: nil)

An alternative (or complimentary) API could also be to add a new class
method that only starts the TCP connection, but returns the socket
on EINPROGRESS:

  TCPSocket.start(remote_host, remote_port,
                  local_host=nil, local_port=nil) => tcp_socket

This means the user would have to wait for writability on the socket
returned by this method (e.g. with IO.select).

I've already implemented something similar for kgio:
  http://bogomips.org/kgio/Kgio/TCPSocket.html#method-c-start

.. and am of course happy to provide patches for Ruby itself if
ruby-core agrees it's a good API to have :>

-- 
Eric Wong