|
Here is a short list of links related to this Java SocketChannel.java source code file:
Java example source code file (SocketChannel.java)
The SocketChannel.java Java example source code/* * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.nio.channels; import java.io.IOException; import java.net.Socket; import java.net.SocketOption; import java.net.SocketAddress; import java.nio.ByteBuffer; import java.nio.channels.spi.AbstractSelectableChannel; import java.nio.channels.spi.SelectorProvider; /** * A selectable channel for stream-oriented connecting sockets. * * <p> A socket channel is created by invoking one of the {@link #open open} * methods of this class. It is not possible to create a channel for an arbitrary, * pre-existing socket. A newly-created socket channel is open but not yet * connected. An attempt to invoke an I/O operation upon an unconnected * channel will cause a {@link NotYetConnectedException} to be thrown. A * socket channel can be connected by invoking its {@link #connect connect} * method; once connected, a socket channel remains connected until it is * closed. Whether or not a socket channel is connected may be determined by * invoking its {@link #isConnected isConnected} method. * * <p> Socket channels support non-blocking connection: A socket * channel may be created and the process of establishing the link to the * remote socket may be initiated via the {@link #connect connect} method for * later completion by the {@link #finishConnect finishConnect} method. * Whether or not a connection operation is in progress may be determined by * invoking the {@link #isConnectionPending isConnectionPending} method. * * <p> Socket channels support asynchronous shutdown, which is similar * to the asynchronous close operation specified in the {@link Channel} class. * If the input side of a socket is shut down by one thread while another * thread is blocked in a read operation on the socket's channel, then the read * operation in the blocked thread will complete without reading any bytes and * will return <tt>-1. If the output side of a socket is shut down by one * thread while another thread is blocked in a write operation on the socket's * channel, then the blocked thread will receive an {@link * AsynchronousCloseException}. * * <p> Socket options are configured using the {@link #setOption(SocketOption,Object) * setOption} method. Socket channels support the following options: * <blockquote> * <table border summary="Socket options"> * <tr> * <th>Option Name * <th>Description * </tr> * <tr> * <td> {@link java.net.StandardSocketOptions#SO_SNDBUF SO_SNDBUF} |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.