Skip to content

TcpListener::bind broken under Windows 7 #26543

Closed

Description

@mohtar

Creating a TCP listener socket will result in error under Windows 7. Minimal test case:

fn main() {
    use std::net::TcpListener;
    let listener = TcpListener::bind("127.0.0.1:8000").unwrap();
}

This will produce an error with code 10041 (WSAEPROTOTYPE).

This was tested on stable Rust (1.0.0).

After a bit digging, turns out this particular piece of code might be the cause of the breakage. According to the Winsock docs, The WSA_FLAG_NO_HANDLE_INHERIT flag is supported on at least Windows 7 SP1, so running on vanilla Windows 7 would not work and would apparently break your program.

Activity

  1. sfackler commented on Jun 24, 2015

    @sfackler
    Member
  2. nagisa commented on Jun 25, 2015

    @nagisa
    Member

    Might be similar to #26518.

  3. added a commit that references this issue on Jul 1, 2015
    8890089
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions