< prev index next >

src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpNet.java

Print this page
rev 59105 : imported patch corelibs


  30 import java.net.InetSocketAddress;
  31 import java.net.SocketAddress;
  32 import java.nio.channels.AlreadyBoundException;
  33 import java.util.Set;
  34 import java.util.HashSet;
  35 import java.security.AccessController;
  36 import java.security.PrivilegedAction;
  37 import sun.net.util.IPAddressUtil;
  38 import sun.nio.ch.IOUtil;
  39 import sun.nio.ch.Net;
  40 import com.sun.nio.sctp.SctpSocketOption;
  41 import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
  42 
  43 public class SctpNet {
  44     private static final String osName = AccessController.doPrivileged(
  45         (PrivilegedAction<String>) () -> System.getProperty("os.name"));
  46 
  47     /* -- Miscellaneous SCTP utilities -- */
  48 
  49     private static boolean IPv4MappedAddresses() {
  50         if ("SunOS".equals(osName)) {
  51             /* Solaris supports IPv4Mapped Addresses with bindx */
  52             return true;
  53         } /* else {  //other OS/implementations  */
  54 
  55         /* lksctp/linux requires Ipv4 addresses */
  56         return false;
  57     }
  58 
  59     static boolean throwAlreadyBoundException() throws IOException {
  60         throw new AlreadyBoundException();
  61     }
  62 
  63     static void listen(int fd, int backlog) throws IOException {
  64         listen0(fd, backlog);
  65     }
  66 
  67     static int connect(int fd, InetAddress remote, int remotePort)
  68             throws IOException {
  69         return connect0(fd, remote, remotePort);
  70     }
  71 
  72     static void close(int fd) throws IOException {
  73         close0(fd);
  74     }




  30 import java.net.InetSocketAddress;
  31 import java.net.SocketAddress;
  32 import java.nio.channels.AlreadyBoundException;
  33 import java.util.Set;
  34 import java.util.HashSet;
  35 import java.security.AccessController;
  36 import java.security.PrivilegedAction;
  37 import sun.net.util.IPAddressUtil;
  38 import sun.nio.ch.IOUtil;
  39 import sun.nio.ch.Net;
  40 import com.sun.nio.sctp.SctpSocketOption;
  41 import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
  42 
  43 public class SctpNet {
  44     private static final String osName = AccessController.doPrivileged(
  45         (PrivilegedAction<String>) () -> System.getProperty("os.name"));
  46 
  47     /* -- Miscellaneous SCTP utilities -- */
  48 
  49     private static boolean IPv4MappedAddresses() {





  50         /* lksctp/linux requires Ipv4 addresses */
  51         return false;
  52     }
  53 
  54     static boolean throwAlreadyBoundException() throws IOException {
  55         throw new AlreadyBoundException();
  56     }
  57 
  58     static void listen(int fd, int backlog) throws IOException {
  59         listen0(fd, backlog);
  60     }
  61 
  62     static int connect(int fd, InetAddress remote, int remotePort)
  63             throws IOException {
  64         return connect0(fd, remote, remotePort);
  65     }
  66 
  67     static void close(int fd) throws IOException {
  68         close0(fd);
  69     }


< prev index next >