Get UDP/TCP Payload for NWConnections?

Is it somehow possible to get the transport layer (UDP and TCP) payload amounts for TLS or QUIC connections established via the Network framework? (From within the app itself that establishes the connections.)

I am currently using the ntstat.h kernel socket calls, but I hope there is a simpler solution. With ntstat, I have not yet been able to observe a specific connection. I have to search for the connection I am looking in all (userspace) connections.

Answered by DTS Engineer in 878111022

The droid you’re looking for here is the startDataTransferReport() method. It ultimately delivers a NWConnection.DataTransferReport structure, which includes statistics for each individual path and aggregated across all paths used by the connection.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

The droid you’re looking for here is the startDataTransferReport() method. It ultimately delivers a NWConnection.DataTransferReport structure, which includes statistics for each individual path and aggregated across all paths used by the connection.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Yes, I already tested that method. But unfortunately, sentTransportByteCount and receivedTransportByteCount don’t include the Handshake payload even when I call startDataTransferReport before starting the connection.

So I get, for example, 35/31 Bytes instead of 1674/3070 Bytes for a simple "send 'Hello' and cancel" TLS connection.

Get UDP/TCP Payload for NWConnections?
 
 
Q