Fix tests on windows

This commit is contained in:
Steven Fackler 2016-10-13 20:01:31 -07:00
parent 143556078b
commit 140ef1b988
1 changed files with 6 additions and 5 deletions

View File

@ -169,12 +169,13 @@ impl Write for UdpConnected {
#[cfg(windows)]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
use std::os::windows::prelude::*;
use libc;
use ws2_32;
let n = unsafe {
libc::send(self.0.as_raw_socket(),
buf.as_ptr() as *const _,
buf.len() as libc::c_int,
0)
ws2_32::send(self.0.as_raw_socket(),
buf.as_ptr() as *const _,
buf.len() as libc::c_int,
0)
};
if n < 0 {
Err(io::Error::last_os_error())