Instance Method

setReadHandler(_:maxDatagrams:)

Set a read handler for datagrams

Declaration

func setReadHandler(_ handler: @escaping ([Data]?, Error?) -> Void, maxDatagrams: Int)

Parameters

handler

A handler called when datagrams have been read, or when an error has occurred.

maxDatagrams

The maximum number of datagrams to send to the handler.

Discussion

Reads will be scheduled by the system, so this method only needs to be called once for a session.

See Also

Transferring Data

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software