receive(minimumIncompleteLength:maximumLength:completion:)
Schedules a single receive completion handler, with a range indicating how many bytes the handler can receive at one time.
Declaration
@preconcurrency final func receive(minimumIncompleteLength: Int, maximumLength: Int, completion: @escaping @Sendable (Data?, NWConnection.ContentContext?, Bool, NWError?) -> Void)Parameters
- minimumIncompleteLength:
The minimum length to receive from the connection, until the content is complete.
- maximumLength:
The maximum length to receive from the connection in a single completion.
- completion:
A receive completion is invoked exactly once for a call to receive. The completion indicates that the requested content has been received (in which case the content is delivered), or that an error has occurred.
The completion delivers the received content, which may be nil if the message is complete or an error occurred, the message context, a flag indicating if the message is complete, and any associated error.