Added extra `socketAddress` function

connection_type_change
Robinson 2021-04-07 02:31:00 +02:00
parent 6774c8c411
commit f097cc195b
1 changed files with 5 additions and 0 deletions

View File

@ -3,6 +3,7 @@
package dorkbox.netUtil
import mu.KotlinLogging
import java.net.InetAddress
import java.net.InetSocketAddress
import java.security.AccessController
import java.security.PrivilegedAction
@ -111,4 +112,8 @@ internal object Common {
fun socketAddress(hostname: String, port: Int): InetSocketAddress {
return AccessController.doPrivileged<InetSocketAddress>(PrivilegedAction { InetSocketAddress(hostname, port) })
}
fun socketAddress(host: InetAddress, port: Int): InetSocketAddress {
return AccessController.doPrivileged<InetSocketAddress>(PrivilegedAction { InetSocketAddress(host, port) })
}
}