develooper Front page | perl.perl5.porters | Postings from July 2012

Re: io_sock.t on MSWin32

Thread Previous | Thread Next
From:
Alex Gough
Date:
July 14, 2012 02:27
Subject:
Re: io_sock.t on MSWin32
Message ID:
20120714092745.GA2994@the.earth.li
> > (Steve or Tony:)
> > 
> > I see two issues just messing about here:
> > 
> > 1) sometimes the ok 10 and ok 11 lines aren't output.
> > 
> > 2) sometimes the socket creation at line 385 fails.
> > 

I've been investigating a little further. The problem lies not
in ourselves, but in our libraries. Windows specifically says
that sent-but-not-transmitted or sent-locally-but-not-read
data might be discarded on socket close, as they take close() to
mean "I'm done with the resources that let this socket work":

http://msdn.microsoft.com/en-us/library/windows/desktop/ms737582(v=vs.85).aspx

The proper approach is to use shutdown() first, to let winsock know
we've done sending data, but still want it delivered, then to call
close, or to set appropriate SO_LINGER or SO_DONTLINGER options:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms740481(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/ms738547(v=vs.85).aspx

In summary, the test failures are happening because the test code is
expecting behaviour on close() which, on win32, isn't supported.
The following patch (to blead) gets the tests to always work. I have not
tried this on a unix/linux but expect it will work fine on those.

Alex
-- 
#!perl
$.=bless ["Just another Perl hacker\n"]; 19800829 .. 20020829;
use overload '0+' => sub {print @{$_[0]}};

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About