* v4MappedAddress is TRUE. Otherwise it will return a sockaddr_in
* structure for an IPv4 InetAddress.
*/
static int NET_InetAddressToSockaddr(JNIEnv env, InetAddress iaObj, int port, SOCKETADDRESS him, boolean v4MappedAddress) {
if (iaObj.family == InetAddress.IPv4) {
him.set(new IPEndPoint(new IPAddress(htonl(iaObj.address) & 0xFFFFFFFFL), port));
return 0;
} else {
Inet6Address v6addr = (Inet6Address)iaObj;
int scope = v6addr.getScopeId();
if (scope == 0) {
him.set(new IPEndPoint(new IPAddress(v6addr.ipaddress), port));
return 0;
} else {
him.set(new IPEndPoint(new IPAddress(v6addr.ipaddress, scope & 0xFFFFFFFFL), port));
return 0;
}
}
}