Module net

Networking primitives.

The types provided in this module are non-blocking by default and are designed to be portable across all supported Mio platforms. As long as the portability guidelines are followed, the behavior should be identical no matter the target platform.

Notes

When using a datagram based socket, i.e. UdpSocket or UnixDatagram, it's only possible to receive a packet once. This means that if you provide a buffer that is too small you won't be able to receive the data anymore. How OSs deal with this situation is different for each OS:

Mio does not change the value (either ok or error) returned by the OS, it's up to the user to handle this. How to deal with these differences is still up for debate, specifically in https://github.com/rust-lang/rust/issues/55794. The best advice we can give is to always call receive with a large enough buffer.

Structs