How to set the socket option SO_REUSEPORT in Rust?
问题 I've read the documentation for std::net and mio, and I've found some methods like set_nodelay and set_keepalive , but I haven't found a way to set other socket options like SO_REUSEPORT and SO_REUSEADDR on a given socket. How can I do this? 回答1: Because SO_REUSEPORT isn't cross-platform, you will need to dip into platform-specific code. In this case, you can get the raw file descriptor from the socket and then use functions, types, and values from the libc crate to set the options you want: