If I use NWConnection for a UDP connection, is there a way to get the peer name? Since it's not a stream, data can theoretically come from anywhere; at the C level, I'd use recvfrom
which would tell me the remote address.
I'm likely to be missing something obvious to everyone but me, I do have a tendency to look at problems as C problems. 😄
You’re right that UDP is not stream based but, when working with UDP, NWConnection
acts like it is. An NWConnection
models a UDP flow, that is, a series of datagrams that all have the some local IP / local port / remote IP / remote port tuple. This is very different from BSD Sockets and it means that there’s no need for the equivalent to the Sockets recvfrom
API.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"