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