Contents

nw_connection_receive_completion_t

A completion handler that indicates when content has been received by the connection, or that an error was encountered.

Declaration

typealias nw_connection_receive_completion_t = (dispatch_data_t?, nw_content_context_t?, Bool, nw_error_t?) -> Void

Parameters

  • content:

    The received content, as constrained by the minimum and maximum length. This may be nil if the message or stream is complete (without any more data to deliver), or if an error was encountered.

  • context:

    Content context describing the received content. This includes protocol metadata that lets the caller introspect information about the received content (such as flags on a packet).

  • is_complete:

    An indication that this context (a message or stream, for example) is now complete. For protocols such as TCP, this will be marked when the entire stream has be closed in the reading direction. For protocols such as UDP, this will be marked when the end of a datagram has been reached.

  • error:

    An error will be sent if the receive was terminated before completing. There may still be content delivered along with the error, but this content may be shorter than the requested ranges. An error will be sent for any outstanding receives when the connection is cancelled.

See Also

Data Types