Post

Replies

Boosts

Views

Activity

Receive NWProtocolIP metadata
I'm attempting to get the receiveTime on each received UDP packet from a NWConnection provided by a NWListener. I've found that @eskimo talks about using this property in this post - "Use receive timestamps to probe point E. In BSD Sockets, set the SO_TIMESTAMP option and access the timestamps by looking at the SCM_TIMESTAMP value returned from recvmsg. In Network framework, set the shouldCalculateReceiveTime property and access the timestamps using the receiveTime property." I have the listeners parameters set up like so: let parameters = NWParameters.udp if let options = parameters.defaultProtocolStack.internetProtocol as? NWProtocolIP.Options { options.shouldCalculateReceiveTime = true } I do have a custom protocol framer involved and working in the network stack. I have been trying the following but the only metadata available is the custom protocol framers: connection.receiveMessage { data, context, isComplete, error in if let metadata = context?.protocolMetadata(definition: NWProtocolIP.definition) { print(metadata) } } Where in a framer implementation can I grab the IP metadata and how, if i do indeed need to, pass it up to the application?
2
0
365
Nov ’23