Hello,
it's possible to get the own socket port for NWConnection?
I open a network connection and will find out the used port on this created socket.
My example code:
IMHO it's totally simple code. Now I want to now the used socket port for my connection.
Where I can read this information? Many thanks.
it's possible to get the own socket port for NWConnection?
I open a network connection and will find out the used port on this created socket.
My example code:
Code Block let queue = DispatchQueue(label: "UDP data thread") let connection = NWConnection(host: "1.2.3.4", port: 40000, using: .udp) connection.start(queue: queue)
IMHO it's totally simple code. Now I want to now the used socket port for my connection.
Where I can read this information? Many thanks.
One thing I did want to follow up on is while there is no localEndpoint property on the NWConnection, there is one on the currentPath of the NWConnection. You can get the local port from here. Something like connection?.currentPath?.localEndpoint should work.
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com