Closed
Description
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 commentedon Jun 23, 2015
@dev-priporov could you run your program with
RUST_BACKTRACE
environment variable set to1
?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 commentedon Jun 24, 2015
$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 anErr
value: Error { repr: Os(10022) }', C:/bot/slave/stable-dist-rustc-win-32/build/src/libcore\result.rs:729failures:
foo
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
dev-priporov commentedon Jun 26, 2015
start main.exe with RUST_BACKTRACE=1
$D:\Documents\Rust\udp>main.exe
' panicked at 'fail bind', C:/bot/slave/stable-dist-rustc-win-32/bthread '
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 commentedon Jul 1, 2015
up
sfackler commentedon Jul 1, 2015
Do you have SP1 installed? If not, it's most likely #26658.
steveklabnik commentedon Jan 3, 2017
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.