setReadHandler(_:maxDatagrams:)
Set a read handler for datagrams.
Declaration
func setReadHandler(_ handler: @escaping ([Data]?, (any 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.