I tried that with both the HANDLE value and with an fd value that I associate with the HANDLE value using _open_osfhandle. The latter fails with EBADF, and the former fails with "the file is not open for writing." I fully expected the former, and the latter sounds a bit like the same class of problem, where I'm basically bringing in a foreign file descriptor that Ruby doesn't really "know about." If for_fd() could handle the case where we're bringing in an fd that Ruby didn't have a real part in creating in the first place, it might make scenarios like this work. -----Original Message----- From: Roger Pack [mailto:rogerdpack / gmail.com] Sent: Friday, June 12, 2009 10:05 AM To: ruby-core / ruby-lang.org Subject: [ruby-core:23822] Re: inheriting socket in child process on native Windows > Besides that, I think using WSADuplicateSocket will suffer from the > same problem that my method does: there is code in rb_w32_select that > prevents select() from being called on sockets not created in the > current process by Ruby's own win32 wrappers around socket(), > accept(), etc.. See the extract_fd call -> is_not_socket -> is_socket > -> lookup in socklist. you might be able to get by with IO.new(some_socket_number) Though I haven't tried it. -=r