Skip to content

std::net::TcpStream::connect_timeout on vxworks #127018

Closed
@biabbas

Description

@biabbas

I'm tracking a issue with connect_timeout function on rust for vxworks. The function is also accepting connections on a non responsive server port. I get errors on unreachable host, but with host that are reachable any connection to a non existent server port is not resulting in an error.

example program:

use std::{
    net::{SocketAddr, TcpStream},
    time::Duration,
};

fn main() {
    let sock_addr: SocketAddr = std::env::args()
        .into_iter()
        .nth(1)
        .unwrap()
        .parse()
        .unwrap();
    dbg!(sock_addr);
    let timeout = Duration::from_secs(5);
    let maybe_stream = TcpStream::connect_timeout(&sock_addr, timeout);
    match maybe_stream {
        Ok(_stream) => println!("Successfully connected to server"),
        Err(err) => eprintln!("Failed to connect to server: {:?}", err),
    };
}

Results:
#./exe 127.0.0.1:90 /// No server at this port
Successfully connected to server
#./exe 192.0.0.1:20 //// Host is unreachable so correct behaviour.
Failed to connect to server
#./exe 172.16.2.223:8002 //Host is reachable, but there's no server at this port
Successfully connected to server

This is not observed with the connect function.
I don't see a specified folder in library/std/src/sys/pal for vxworks. I found only one file for vxworks library/std/src/sys/pal/unix/process/process_vxworks.rs files. Does vxworks fall back on unix implementations for these functionalities? Any leads on how to proceed would be really helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-vxworksTarget: when they made us, they called us Curiosity, and Spirit, and told us to tell you helloT-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions