-
Notifications
You must be signed in to change notification settings - Fork 197
Open
Description
Is is somehow possible with this library to get the local IP address to which the socket is currently bound? E.g. I have following Android Java code which I need to translate to Swift
private static InetAddress getOutboundAddress(SocketAddress remoteAddress) {
InetAddress localAddress = null;
try {
DatagramSocket sock = new DatagramSocket();
// connect is needed to bind the socket and retrieve the local address later (it would return 0.0.0.0 otherwise)
sock.connect(remoteAddress);
localAddress = sock.getLocalAddress();
sock.disconnect();
sock.close();
} catch (Exception e) {
// ignore
}
return localAddress;
}
is there a way which is similar to localAddress = sock.getLocalAddress();?
Metadata
Metadata
Assignees
Labels
No labels