Thanks for your answer.
I'm trying to understand how NWTCPConnection can possibly help in my case? Even if I use Apple API only for establishing the connection I don't see a way to nicely switch the connection to the new (possibly better) interface.
Let's take as an example the NWConnection API. I see there is an API to handle a better path:
var betterPathUpdateHandler: (Bool) -> Void)?
A handler that receives updates when an alternative network path is preferred over the current path.
Better path events are an indication that a more preferable network path is available. If you can migrate your work to a new connection, try establishing a new connection. Once that new connection is ready, cancel the original connection.
But I don't know how to really use it? It says that I should establish new connection. Does that mean that I should create new NWConnection instance and cancel the old one? If so, it is much less efficient than using simply bind to bind the socket to a new interface.
As to the suggestion of using NWTCPConnection I don't see anything in the API documentation which might help in my case? Maybe do you have some example code which uses its API?
Topic:
App & System Services
SubTopic:
Networking
Tags: