Skip to content

error UDP socket #26518

Closed
Closed
@dev-priporov

Description

@dev-priporov

I have that code:

fn main() {
    let socket = UdpSocket::bind("127.0.0.1:23451").ok().expect("fail bind");
    let mut buf = [0; 2];
    buf[0]=11;
    buf[1]=22;
    socket.send_to(&buf, "127.0.0.1:23451").ok().expect("fail send");
    println!("{:?}", buf);
}

and I start it in 2 different PC with OS win7 32 , and have 2 different error:
1)thread '' panicked at 'called Result::unwrap() on an Err value: Error { repr: Os(10022) }',
C:/bot/slave/stable-dist-rustc-win-32/build/src/libcore\result.rs:729
2)thread '' panicked at 'fail bind', C:/bot/slave/stable-dist-rustc-win-32/b
uild/src/libcore\option.rs:330
This errors com in after first string:

let socket = UdpSocket::bind("127.0.0.1:23451").ok().expect("fail bind");

Activity

nagisa

nagisa commented on Jun 23, 2015

@nagisa
Member

@dev-priporov could you run your program with RUST_BACKTRACE environment variable set to 1?

10022 error code in Windows means invalid argument; I can’t tell you what’s the reason for 2nd variant, but at least it is not the standard library using unwrap somewhere incorrectly.

dev-priporov

dev-priporov commented on Jun 24, 2015

@dev-priporov
Author
#[test]
fn foo(){
    let socket = UdpSocket::bind("127.0.0.1:5001").ok().expect("fail bind");;//.expect("fail bind");

}

$cargo test

result:

Compiling main v0.1.0 (file:///D:/Documents/Rust/udp/main)
Running target\debug\main-9041d3d24bce4adb.exe

running 1 test
test foo ... FAILED

failures:

---- foo stdout ----
thread 'foo' panicked at 'called Result::unwrap() on an Err value: Error { repr: Os(10022) }', C:/bot/slave/stable-dist-rustc-win-32/build/src/libcore\result.rs:729
failures:
foo
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured

dev-priporov

dev-priporov commented on Jun 26, 2015

@dev-priporov
Author

start main.exe with RUST_BACKTRACE=1

$D:\Documents\Rust\udp>main.exe
thread '

' panicked at 'fail bind', C:/bot/slave/stable-dist-rustc-win-32/b
uild/src/libcore\option.rs:330
stack backtrace:
1: 0x447e9f - main
2: 0x40a9bc - main
3: 0x40b3df - main
4: 0x447900 - main
5: 0x4623f8 - main
6: 0x40492f
7: 0x404560
8: 0x44aa7c - main
9: 0x406827 - main
10: 0x4013de
11: 0x77071174 - BaseThreadInitThunk
12: 0x7737b3f5 - RtlInitializeExceptionChain

dev-priporov

dev-priporov commented on Jul 1, 2015

@dev-priporov
Author

up

sfackler

sfackler commented on Jul 1, 2015

@sfackler
Member

Do you have SP1 installed? If not, it's most likely #26658.

steveklabnik

steveklabnik commented on Jan 3, 2017

@steveklabnik
Member

Triage: it's been a long time, and with no response about SP1, I'm going to give this a close.

@dev-priporov if you're still seeing this today, please let me know and we can re-open.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @steveklabnik@nagisa@sfackler@dev-priporov

        Issue actions

          error UDP socket · Issue #26518 · rust-lang/rust