src/share/classes/java/nio/channels/SocketChannel.java

Print this page




 320      * <tt>false</tt> and the connection operation must later be completed by
 321      * invoking the {@link #finishConnect finishConnect} method.
 322      *
 323      * <p> If this channel is in blocking mode then an invocation of this
 324      * method will block until the connection is established or an I/O error
 325      * occurs.
 326      *
 327      * <p> This method performs exactly the same security checks as the {@link
 328      * java.net.Socket} class.  That is, if a security manager has been
 329      * installed then this method verifies that its {@link
 330      * java.lang.SecurityManager#checkConnect checkConnect} method permits
 331      * connecting to the address and port number of the given remote endpoint.
 332      *
 333      * <p> This method may be invoked at any time.  If a read or write
 334      * operation upon this channel is invoked while an invocation of this
 335      * method is in progress then that operation will first block until this
 336      * invocation is complete.  If a connection attempt is initiated but fails,
 337      * that is, if an invocation of this method throws a checked exception,
 338      * then the channel will be closed.  </p>
 339      *






 340      * @param  remote
 341      *         The remote address to which this channel is to be connected
 342      *
 343      * @return  <tt>true</tt> if a connection was established,
 344      *          <tt>false</tt> if this channel is in non-blocking mode
 345      *          and the connection operation is in progress
 346      *
 347      * @throws  AlreadyConnectedException
 348      *          If this channel is already connected
 349      *
 350      * @throws  ConnectionPendingException
 351      *          If a non-blocking connection operation is already in progress
 352      *          on this channel
 353      *
 354      * @throws  ClosedChannelException
 355      *          If this channel is closed
 356      *
 357      * @throws  AsynchronousCloseException
 358      *          If another thread closes this channel
 359      *          while the connect operation is in progress




 320      * <tt>false</tt> and the connection operation must later be completed by
 321      * invoking the {@link #finishConnect finishConnect} method.
 322      *
 323      * <p> If this channel is in blocking mode then an invocation of this
 324      * method will block until the connection is established or an I/O error
 325      * occurs.
 326      *
 327      * <p> This method performs exactly the same security checks as the {@link
 328      * java.net.Socket} class.  That is, if a security manager has been
 329      * installed then this method verifies that its {@link
 330      * java.lang.SecurityManager#checkConnect checkConnect} method permits
 331      * connecting to the address and port number of the given remote endpoint.
 332      *
 333      * <p> This method may be invoked at any time.  If a read or write
 334      * operation upon this channel is invoked while an invocation of this
 335      * method is in progress then that operation will first block until this
 336      * invocation is complete.  If a connection attempt is initiated but fails,
 337      * that is, if an invocation of this method throws a checked exception,
 338      * then the channel will be closed.  </p>
 339      *
 340      * <p> Once a connection is established,
 341      * {@link java.nio.channels.Selector#select() Selector.select()} method
 342      * should never select <tt>OP_CONNECT</tt> again. Please see
 343      * {@link java.nio.channels.Selector#select() Selector.select()} for detail.
 344      * </p>
 345      *
 346      * @param  remote
 347      *         The remote address to which this channel is to be connected
 348      *
 349      * @return  <tt>true</tt> if a connection was established,
 350      *          <tt>false</tt> if this channel is in non-blocking mode
 351      *          and the connection operation is in progress
 352      *
 353      * @throws  AlreadyConnectedException
 354      *          If this channel is already connected
 355      *
 356      * @throws  ConnectionPendingException
 357      *          If a non-blocking connection operation is already in progress
 358      *          on this channel
 359      *
 360      * @throws  ClosedChannelException
 361      *          If this channel is closed
 362      *
 363      * @throws  AsynchronousCloseException
 364      *          If another thread closes this channel
 365      *          while the connect operation is in progress