Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve UdpSocket documentation #105394

Merged
merged 1 commit into from
Oct 3, 2023
Merged

Commits on Aug 22, 2023

  1. Improve UdpSocket documentation

    I tried working with `UdpSocket` and ran into `EINVAL` errors with no
    clear indication of what causes the error. Also, it was uncharacteristically
    hard to figure this module out, compared to other Rust `std` modules.
    
    1. `send` and `send_to` return a `usize`
    This one is just clarity. Usually, returned `usize`s indicate that the
    buffer might have only been sent partially. This is not the case with
    UDP. Since that `usize` must always be `buffer.len()`, I have documented
    that.
    
    2. `bind` limits `connect` and `send_to`
    When you bind to a limited address space like localhost, you can only
    `connect` to addresses in that same address space. Error kind:
    `AddrNotAvailable`.
    
    3. `connect`ing to localhost locks you to localhost
    On Linux, if you first `connect` to localhost, subsequent `connect`s to
    non-localhost addresses fail. Error kind: `InvalidInput`.
    
    Co-authored-by: Jubilee <[email protected]>
    Patiga and workingjubilee committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    adb22b9 View commit details
    Browse the repository at this point in the history