/** * @since Available in iOS 2.0 and later. */ public static SCNetworkReachability create(java.net.InetSocketAddress localAddress, java.net.InetSocketAddress remoteAddress) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); Struct<?> l; Struct<?> r; if (localAddress.getAddress() instanceof java.net.Inet4Address) { l = new sockaddr_in(localAddress); } else if (localAddress.getAddress() instanceof java.net.Inet6Address) { l = new sockaddr_in6(localAddress); } else { throw new IllegalArgumentException("localAddress is not a valid IPv4 or IPv6 address!"); } if (remoteAddress.getAddress() instanceof java.net.Inet4Address) { r = new sockaddr_in(remoteAddress); } else if (remoteAddress.getAddress() instanceof java.net.Inet6Address) { r = new sockaddr_in6(remoteAddress); } else { throw new IllegalArgumentException("remoteAddress is not a valid IPv4 or IPv6 address!"); } SCNetworkReachability reachability = create(null, l, r); reachability.localRefconId = refconId; return reachability; } /**
public InetSocketAddress toInetSocketAddress() { try { Inet6Address address = Inet6Address.getByAddress(null, sin6_addr(), (int)sin6_scope_id()); return new InetSocketAddress(address, sin6_port()); } catch (UnknownHostException e) { e.printStackTrace(); } return null; } }
public sockaddr_in6() { sin6_len((byte)sizeOf()); sin6_family(AF_INET6); }
public sockaddr_in6(InetSocketAddress address) { this(); sin6_port((short)address.getPort()); InetAddress addr = address.getAddress(); if (!(addr instanceof Inet6Address)) { throw new IllegalArgumentException("address must be a valid IPv6 address!"); } sin6_addr(addr.getAddress()); sin6_scope_id(((Inet6Address)addr).getScopeId()); }
public sockaddr_in6() { sin6_len((byte)sizeOf()); sin6_family(AF_INET6); }
/** * @since Available in iOS 2.0 and later. */ public static SCNetworkReachability create(java.net.InetSocketAddress address) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); SCNetworkReachability reachability; java.net.InetAddress addr = address.getAddress(); if (addr instanceof java.net.Inet4Address) { reachability = create(null, new sockaddr_in(address)); } else if (addr instanceof java.net.Inet6Address) { reachability = create(null, new sockaddr_in6(address)); } else { throw new IllegalArgumentException("address is not a valid IPv4 or IPv6 address!"); } reachability.localRefconId = refconId; return reachability; } /**
public InetSocketAddress toInetSocketAddress() { try { Inet6Address address = Inet6Address.getByAddress(null, sin6_addr(), (int)sin6_scope_id()); return new InetSocketAddress(address, sin6_port()); } catch (UnknownHostException e) { e.printStackTrace(); } return null; } }
public sockaddr_in6() { sin6_len((byte)sizeOf()); sin6_family(AF_INET6); }
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachability(java.net.InetSocketAddress localAddress, java.net.InetSocketAddress remoteAddress) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); Struct<?> l; Struct<?> r; if (localAddress.getAddress() instanceof java.net.Inet4Address) { l = new sockaddr_in(localAddress); } else if (localAddress.getAddress() instanceof java.net.Inet6Address) { l = new sockaddr_in6(localAddress); } else { throw new IllegalArgumentException("localAddress is not a valid IPv4 or IPv6 address!"); } if (remoteAddress.getAddress() instanceof java.net.Inet4Address) { r = new sockaddr_in(remoteAddress); } else if (remoteAddress.getAddress() instanceof java.net.Inet6Address) { r = new sockaddr_in6(remoteAddress); } else { throw new IllegalArgumentException("remoteAddress is not a valid IPv4 or IPv6 address!"); } long reachability = create(null, l, r); localRefconId = refconId; setHandle(reachability); } /**
public InetSocketAddress toInetSocketAddress() { try { Inet6Address address = Inet6Address.getByAddress(null, sin6_addr(), (int)sin6_scope_id()); return new InetSocketAddress(address, sin6_port()); } catch (UnknownHostException e) { e.printStackTrace(); } return null; } }
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachability(java.net.InetSocketAddress localAddress, java.net.InetSocketAddress remoteAddress) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); Struct<?> l; Struct<?> r; if (localAddress.getAddress() instanceof java.net.Inet4Address) { l = new sockaddr_in(localAddress); } else if (localAddress.getAddress() instanceof java.net.Inet6Address) { l = new sockaddr_in6(localAddress); } else { throw new IllegalArgumentException("localAddress is not a valid IPv4 or IPv6 address!"); } if (remoteAddress.getAddress() instanceof java.net.Inet4Address) { r = new sockaddr_in(remoteAddress); } else if (remoteAddress.getAddress() instanceof java.net.Inet6Address) { r = new sockaddr_in6(remoteAddress); } else { throw new IllegalArgumentException("remoteAddress is not a valid IPv4 or IPv6 address!"); } long reachability = create(null, l, r); localRefconId = refconId; setHandle(reachability); } /**
public sockaddr_in6(InetSocketAddress address) { this(); sin6_port((short)address.getPort()); InetAddress addr = address.getAddress(); if (!(addr instanceof Inet6Address)) { throw new IllegalArgumentException("address must be a valid IPv6 address!"); } sin6_addr(addr.getAddress()); sin6_scope_id(((Inet6Address)addr).getScopeId()); }
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachability(java.net.InetSocketAddress address) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); long reachability; java.net.InetAddress addr = address.getAddress(); if (addr instanceof java.net.Inet4Address) { reachability = create(null, new sockaddr_in(address)); } else if (addr instanceof java.net.Inet6Address) { reachability = create(null, new sockaddr_in6(address)); } else { throw new IllegalArgumentException("address is not a valid IPv4 or IPv6 address!"); } localRefconId = refconId; setHandle(reachability); } /**
public sockaddr_in6(InetSocketAddress address) { this(); sin6_port((short)address.getPort()); InetAddress addr = address.getAddress(); if (!(addr instanceof Inet6Address)) { throw new IllegalArgumentException("address must be a valid IPv6 address!"); } sin6_addr(addr.getAddress()); sin6_scope_id(((Inet6Address)addr).getScopeId()); }
/** * @since Available in iOS 2.0 and later. */ public SCNetworkReachability(java.net.InetSocketAddress address) { long refconId = SCNetworkReachability.refconId.getAndIncrement(); long reachability; java.net.InetAddress addr = address.getAddress(); if (addr instanceof java.net.Inet4Address) { reachability = create(null, new sockaddr_in(address)); } else if (addr instanceof java.net.Inet6Address) { reachability = create(null, new sockaddr_in6(address)); } else { throw new IllegalArgumentException("address is not a valid IPv4 or IPv6 address!"); } localRefconId = refconId; setHandle(reachability); } /**