I'm observing a strange behavior based on the nw_connection state.
I'm running the client code that exercises the same query code listed below twice - once on nw_connection_state_preparing and the second on nw_connection_state_ready and getting a different source port.
nw_path_t path = nw_connection_copy_current_path(m_connection);
nw_endpoint_t endpoint = nw_path_copy_effective_local_endpoint(path);
uint16_t port = nw_endpoint_get_port(endpoint);
Can you please advise why and what is the correct state to get the source port on?
The requirement on our side is to know the source port before the remote process accepts the connection.
Topic:
App & System Services
SubTopic:
Networking
Tags: