[New-bugs-announce] [issue14300] dup_socket() on Windows should use WSA_FLAG_OVERLAPPED

sbt report at bugs.python.org
Wed Mar 14 13:59:46 CET 2012


New submission from sbt <shibturn at gmail.com>:

According to Microsoft's documentation sockets created using socket() have the
overlapped attribute, but sockets created with WSASocket() do not unless you 
pass the WSA_FLAG_OVERLAPPED flag.  The documentation for WSADuplicateSocket()
says

  If the source process uses the socket function to create the socket, the 
  destination process must pass the WSA_FLAG_OVERLAPPED flag to its WSASocket 
  function call.

This means that dup_socket() in socketmodule.c should use

    return WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
                     FROM_PROTOCOL_INFO, &info, 0, WSA_FLAG_OVERLAPPED);

instead of

    return WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO,
                     FROM_PROTOCOL_INFO, &info, 0, 0);

(On Windows, the new multiprocessing.connection.wait() function depends on
the overlapped attribute, although it is primarily intended for use with pipe 
connections not sockets.)

Patch attached.

----------
files: socket_dup.patch
keywords: patch
messages: 155748
nosy: sbt
priority: normal
severity: normal
status: open
title: dup_socket() on Windows should use WSA_FLAG_OVERLAPPED
versions: Python 3.3
Added file: http://bugs.python.org/file24841/socket_dup.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14300>
_______________________________________


More information about the New-bugs-announce mailing list