mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-06-14 03:32:00 +08:00
feat: 初步增加 Windows 支持
This commit is contained in:
14
src/utils/net_disabled.rs
Normal file
14
src/utils/net_disabled.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use std::io;
|
||||
use std::net::{SocketAddr, TcpListener, UdpSocket};
|
||||
|
||||
pub fn bind_tcp_listener(addr: SocketAddr) -> io::Result<TcpListener> {
|
||||
let listener = TcpListener::bind(addr)?;
|
||||
listener.set_nonblocking(true)?;
|
||||
Ok(listener)
|
||||
}
|
||||
|
||||
pub fn bind_udp_socket(addr: SocketAddr) -> io::Result<UdpSocket> {
|
||||
let socket = UdpSocket::bind(addr)?;
|
||||
socket.set_nonblocking(true)?;
|
||||
Ok(socket)
|
||||
}
|
||||
Reference in New Issue
Block a user