|
|||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||
概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Object | +--java.net.Socket | +--mdw.nbio.NonblockingSocket
A NonblockingSocket is a socket which exports nonblocking input/output
streams. It is otherwise idential to a standard socket.
Socket connection can be either blocking or nonblocking. Use of the
standard constructors causes the current thread to block until
the connection is established. Otherwise, there are 3 ways to check
if the connection has been established:
(1) Call finishConnection
,
(2) Call connectDone
, or
(3) Create a SelectSet
and select on the event
Selectable.CONNECT_READY
, then call connectDone
.
SelectSet
インタフェース mdw.nbio.Selectable から継承したフィールド |
ACCEPT_READY, CONNECT_READY, READ_READY, SELECT_ERROR, WRITE_READY |
コンストラクタの概要 | |
NonblockingSocket(java.net.InetAddress address,
int port)
Create a NonblockingSocket connection to the given host and port number. |
|
NonblockingSocket(java.net.InetAddress address,
int port,
boolean block)
Create a NonblockingSocket connection to the given host and port number. |
|
NonblockingSocket(java.lang.String host,
int port)
Create a NonblockingSocket connection to the given host and port number. |
|
NonblockingSocket(java.lang.String host,
int port,
boolean block)
Create a NonblockingSocket connection to the given host and port number. |
メソッドの概要 | |
void |
close()
Closes the socket. |
boolean |
connectDone()
Indicate whether the connection on this socket has been established. |
boolean |
finishConnect(int timeout)
Block until the connection on this socket has been established. |
java.net.InetAddress |
getInetAddress()
Return the remote address to which this socket is bound. |
java.io.InputStream |
getInputStream()
Return an InputStream from which data on this socket can be read. |
java.net.InetAddress |
getLocalAddress()
Return the local address to which this socket is bound. |
int |
getLocalPort()
Return the local port to which this socket is bound. |
java.io.OutputStream |
getOutputStream()
Return an OutputStream to which data on this socket can be written. |
int |
getPort()
Return the remote port to which this socket is bound. |
int |
getSoLinger()
Currently unimplemented. |
int |
getSoTimeout()
Currently unimplemented. |
boolean |
getTcpNoDelay()
Currently unimplemented. |
void |
setSoLinger(boolean on,
int val)
Currently unimplemented. |
void |
setSoTimeout(int timeout)
Currently unimplemented. |
void |
setTcpNoDelay(boolean on)
Currently unimplemented. |
java.lang.String |
toString()
|
クラス java.net.Socket から継承したメソッド |
getKeepAlive, getReceiveBufferSize, getSendBufferSize, setKeepAlive, setReceiveBufferSize, setSendBufferSize, setSocketImplFactory, shutdownInput, shutdownOutput |
クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
コンストラクタの詳細 |
public NonblockingSocket(java.lang.String host, int port) throws java.net.UnknownHostException, java.io.IOException
public NonblockingSocket(java.lang.String host, int port, boolean block) throws java.net.UnknownHostException, java.io.IOException
public NonblockingSocket(java.net.InetAddress address, int port) throws java.net.UnknownHostException, java.io.IOException
public NonblockingSocket(java.net.InetAddress address, int port, boolean block) throws java.io.IOException
メソッドの詳細 |
public boolean finishConnect(int timeout) throws java.net.SocketException
connectDone
). A timeout of -1
causes this call to block indefinitely until the connection is
established.public boolean connectDone() throws java.net.SocketException
public java.net.InetAddress getInetAddress()
java.net.Socket
内の getInetAddress
public java.net.InetAddress getLocalAddress()
java.net.Socket
内の getLocalAddress
public int getPort()
java.net.Socket
内の getPort
public int getLocalPort()
java.net.Socket
内の getLocalPort
public java.io.InputStream getInputStream() throws java.io.IOException
java.net.Socket
内の getInputStream
public java.io.OutputStream getOutputStream() throws java.io.IOException
java.net.Socket
内の getOutputStream
public void setTcpNoDelay(boolean on) throws java.net.SocketException
java.net.Socket
内の setTcpNoDelay
public boolean getTcpNoDelay() throws java.net.SocketException
java.net.Socket
内の getTcpNoDelay
public void setSoLinger(boolean on, int val) throws java.net.SocketException
java.net.Socket
内の setSoLinger
public int getSoLinger() throws java.net.SocketException
java.net.Socket
内の getSoLinger
public void setSoTimeout(int timeout) throws java.net.SocketException
java.net.Socket
内の setSoTimeout
public int getSoTimeout() throws java.net.SocketException
java.net.Socket
内の getSoTimeout
public void close() throws java.io.IOException
java.net.Socket
内の close
public java.lang.String toString()
java.net.Socket
内の toString
|
|||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||
概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |