Skip to content

TcpListener::bind broken under Windows 7 #26543

Closed
@mohtar

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.

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