Rust Requires Chilkat v11.0.0+
Rust
Example: Socket.AcceptNext method
Demonstrates how to call the AcceptNext method.Chilkat Rust Downloads
let listen_socket = chilkat::Socket::new();
let connected_socket = chilkat::Socket::new();
let port = 5555;
let backlog = 25;
if listen_socket.bind_and_listen(port, backlog).is_err() {
println!("{}", listen_socket.last_error_text());
return;
}
// Accept next incoming connection
let mut max_wait_ms = 200000;
if listen_socket.accept_next(max_wait_ms, &connected_socket).is_err() {
println!("{}", listen_socket.last_error_text());
return;
}
// ...
// ...
max_wait_ms = 20000;
let _ = connected_socket.close(max_wait_ms);