src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java

Print this page




  50 
  51     /* cached socket options */
  52     private int multicastInterface = 0;
  53     private boolean loopbackMode = true;
  54     private int ttl = -1;
  55 
  56     private static final String os = AccessController.doPrivileged(
  57         new sun.security.action.GetPropertyAction("os.name")
  58     );
  59 
  60     /**
  61      * flag set if the native connect() call not to be used
  62      */
  63     private final static boolean connectDisabled = os.contains("OS X");
  64 
  65     /**
  66      * Load net library into runtime.
  67      */
  68     static {
  69         java.security.AccessController.doPrivileged(
  70                   new sun.security.action.LoadLibraryAction("net"));



  71     }


  72 
  73     /**
  74      * Creates a datagram socket
  75      */
  76     protected synchronized void create() throws SocketException {
  77         ResourceManager.beforeUdpCreate();
  78         fd = new FileDescriptor();
  79         try {
  80             datagramSocketCreate();
  81         } catch (SocketException ioe) {
  82             ResourceManager.afterUdpClose();
  83             fd = null;
  84             throw ioe;
  85         }
  86     }
  87 
  88     /**
  89      * Binds a datagram socket to a local port.
  90      */
  91     protected synchronized void bind(int lport, InetAddress laddr)




  50 
  51     /* cached socket options */
  52     private int multicastInterface = 0;
  53     private boolean loopbackMode = true;
  54     private int ttl = -1;
  55 
  56     private static final String os = AccessController.doPrivileged(
  57         new sun.security.action.GetPropertyAction("os.name")
  58     );
  59 
  60     /**
  61      * flag set if the native connect() call not to be used
  62      */
  63     private final static boolean connectDisabled = os.contains("OS X");
  64 
  65     /**
  66      * Load net library into runtime.
  67      */
  68     static {
  69         java.security.AccessController.doPrivileged(
  70             new java.security.PrivilegedAction<Void>() {
  71                 public Void run() {
  72                     System.loadLibrary("net");
  73                     return null;
  74                 }
  75             });
  76     }
  77 
  78     /**
  79      * Creates a datagram socket
  80      */
  81     protected synchronized void create() throws SocketException {
  82         ResourceManager.beforeUdpCreate();
  83         fd = new FileDescriptor();
  84         try {
  85             datagramSocketCreate();
  86         } catch (SocketException ioe) {
  87             ResourceManager.afterUdpClose();
  88             fd = null;
  89             throw ioe;
  90         }
  91     }
  92 
  93     /**
  94      * Binds a datagram socket to a local port.
  95      */
  96     protected synchronized void bind(int lport, InetAddress laddr)