Network.framework socket errors opening .unix socket

Whenever I open a .unix socket (i.e.: /var/run/usbmuxd) I get the following errors in Xcode console:

nw_socket_set_common_sockopts [C13:1] setsockopt SO_NECP_CLIENTUUID failed [22: Invalid argument]
Type: Error | Timestamp: 2024-04-18 15:48:44.813556-04:00 | Process: TH Dev | Library: Network | Subsystem: com.apple.network | Category: connection | TID: 0x425e2
nw_socket_set_common_sockopts setsockopt SO_NECP_CLIENTUUID failed [22: Invalid argument]
Type: Error | Timestamp: 2024-04-18 15:48:44.813682-04:00 | Process: TH Dev | Library: Network | Subsystem: com.apple.network | Category:  | TID: 0x425e2
nw_socket_copy_info [C13:1] getsockopt TCP_INFO failed [102: Operation not supported on socket]
Type: Error | Timestamp: 2024-04-18 15:48:44.814484-04:00 | Process: TH Dev | Library: Network | Subsystem: com.apple.network | Category: connection | TID: 0x425e2
nw_socket_copy_info getsockopt TCP_INFO failed [102: Operation not supported on socket]
Type: Error | Timestamp: 2024-04-18 15:48:44.814523-04:00 | Process: TH Dev | Library: Network | Subsystem: com.apple.network | Category:  | TID: 0x425e2

While communication to/from the socket seems to work, the operations leading to these errors shouldn't be attempted if the socket doesn't support them.

Replies

Connection is established using:

let connection = NWConnection(to: .unix(path: "/var/run/usbmuxd"), using: NWParameters.applicationService)
connection.stateUpdateHandler = { [weak self] in self?.onConnectionState($0) }
connection.start(queue: Self.dispatchQueue)

Where Self.dispatchQueue is a serial DispatchQueue with maximum 1 thread, .background QOS

While communication to/from the socket seems to work

That makes this log noise.

WARNING /var/run/usbmuxd is not considered API and if you base your product on it you will likely run into compatibility problems in the future.

Share and Enjoy

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