src/java.base/share/classes/sun/nio/ch/Net.java
branchniosocketimpl-branch
changeset 57274 07b6be5d9150
parent 57268 adcdd45830a0
child 57278 bf925a3ee68a
equal deleted inserted replaced
57270:3519688a4e4d 57274:07b6be5d9150
   533 
   533 
   534     private static native void setIntOption0(FileDescriptor fd, boolean mayNeedConversion,
   534     private static native void setIntOption0(FileDescriptor fd, boolean mayNeedConversion,
   535                                              int level, int opt, int arg, boolean isIPv6)
   535                                              int level, int opt, int arg, boolean isIPv6)
   536         throws IOException;
   536         throws IOException;
   537 
   537 
       
   538     /**
       
   539      * Polls a file descriptor for events.
       
   540      * @param timeout the timeout to wait; 0 to not wait, -1 to wait indefinitely
       
   541      * @return the polled events or 0 if no events are polled
       
   542      */
   538     static native int poll(FileDescriptor fd, int events, long timeout)
   543     static native int poll(FileDescriptor fd, int events, long timeout)
   539         throws IOException;
   544         throws IOException;
   540 
   545 
       
   546     /**
       
   547      * Performs a non-blocking poll of a file descriptor.
       
   548      * @return the polled events or 0 if no events are polled
       
   549      */
   541     static int pollNow(FileDescriptor fd, int events) throws IOException {
   550     static int pollNow(FileDescriptor fd, int events) throws IOException {
   542         return poll(fd, events, 0);
   551         return poll(fd, events, 0);
   543     }
   552     }
   544 
   553 
   545     /**
   554     /**
   546      * Polls a connecting socket to test if the connection has been established.
   555      * Polls a connecting socket to test if the connection has been established.
   547      *
   556      *
   548      * @apiNote This method is public to allow it be used by code in jdk.sctp.
   557      * @apiNote This method is public to allow it be used by code in jdk.sctp.
   549      *
   558      *
   550      * @param timeout the timeout to wait; 0 to not wait, -1 to wait indefinitely
   559      * @param timeout the timeout to wait; 0 to not wait, -1 to wait indefinitely
   551      * @return 1 if connected, 0 if not connected, or IOS_INTERRUPTED
   560      * @return true if connected
   552      */
   561      */
   553     public static native int pollConnect(FileDescriptor fd, long timeout)
   562     public static native boolean pollConnect(FileDescriptor fd, long timeout)
   554         throws IOException;
   563         throws IOException;
   555 
   564 
   556     static int pollConnectNow(FileDescriptor fd) throws IOException {
   565     /**
       
   566      * Performs a non-blocking poll of a connecting socket to test if the
       
   567      * connection has been established.
       
   568      *
       
   569      * @return true if connected
       
   570      */
       
   571     static boolean pollConnectNow(FileDescriptor fd) throws IOException {
   557         return pollConnect(fd, 0);
   572         return pollConnect(fd, 0);
   558     }
   573     }
   559 
   574 
   560     /**
   575     /**
   561      * Return the number of bytes in the socket input buffer.
   576      * Return the number of bytes in the socket input buffer.