Date: | Wed, 6 Nov 2002 21:06:43 -0500 |
From: | Rocco Caputo <troc [...] netrus.net> |
To: | poe [...] perl.org |
Cc: | bug-POE [...] rt.cpan.org |
Subject: | Re: Win32: WSA_OVERLAPPED_IO and non-blocking connect() |
On Wed, Nov 06, 2002 at 05:08:48PM -0600, Garrett Goebel wrote:
Show quoted text
> Rocco,
>
> I apologize for my ignorance in advanced. I've started re-reading "Network
> Programming with Perl". -Which I'd read once long ago, never used, and
> consequently have completely forgotten.
>
> I noticed your post to p5p on this issue back in August 2001:
> http://archive.develooper.com/perl5-porters@perl.org/msg62779.html
>
> Where you use ioctl to flip the socket to non-blocking mode (as stolen from
> POE::Wheel::SocketFactory).
>
> I also noticed an interesting article:
> INFO: Socket Overlapped I/O Versus Blocking/Non-blocking Mode
> http://support.microsoft.com/default.aspx?scid=kb;en-us;Q181611
>
> Where it says:
It's an excellent lead and one I'll be pursuing once I get this NT
machine set up. You may be right about "pie in the sky". If
ActiveState is correct, the overlapped mode is required so that the
socket will behave like a filehandle in all other respects.
It's a shame that overlapped mode can't be changed after the socket is
created. Otherwise I could treat the socket as non-overlapped for the
duration of the connect and then set it back to overlapping for I/O.
I'm probably going to release 0.24 before getting to work on the
Windows issues again, if only because 0.24 is practically ready to go
now.
Cc'd to bug-POE@rt.cpan.org for posterity.
-- Rocco Caputo - troc@pobox.com - http://poe.perl.org/
> > Please note that once a socket is created, there is no way
> > to change the socket overlapped attribute. However, you can
> > call the setsockopt API with SO_OPENTYPE option on any socket
> > handles including an INVALID_SOCKET to change the overlapped
> > attributes for all successive socket calls in the same thread.
> > The default SO_OPENTYPE option value is 0, which sets the
> > overlapped attribute. All non-zero option values make the
> > socket synchronous and make it so that you cannot use a
> > completion function
>
> So I'm wondering if there's an exposed mechanism in perl to set this
> attribute similar to how you used ioctl to set the FIONBIO attribute? I'm
> not sure what "all successive socket calls" means... but I'm curious if
> having set this attribute, followed by the FIONBIO call to ioctl... you
> might be able to get that non-blocking connect?
>
> Its probably just one of those "pie in the sky" ideas which ignorance allows
> one to think is possible...