📄 socketconnection.java
字号:
/* * Created on 2005-8-15 by pcy * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */package javax.microedition.io;import java.lang.IllegalArgumentException;import java.io.IOException;import java.lang.String;/** * @author pcy * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */public interface SocketConnection extends StreamConnection { /** * Socket option for the small buffer <em>writing delay</em> (0). * Set to zero to disable Nagle algorithm for * small buffer operations. * Set to a non-zero value to enable. */ public final byte DELAY = 0; /** * Socket option for the <em>linger time</em> to wait in seconds * before closing a connection with * pending data output (1). Setting the linger time to zero * disables the linger wait interval. */ public final byte LINGER = 1; /** * Socket option for the <em>keep alive</em> feature (2). * Setting KEEPALIVE to zero will disable the feature. * Setting KEEPALIVE to a non-zero value will enable the feature. */ public final byte KEEPALIVE = 2; /** * Socket option for the size of the <em>receiving buffer</em> (3). */ public final byte RCVBUF = 3; /** * Socket option for the size of the <em>sending buffer</em> (4). */ public final byte SNDBUF = 4; /** * Set a socket option for the connection. * <P> * Options inform the low level networking code about intended * usage patterns that the application will use in dealing with * the socket connection. * </P> * <P> * Calling <code>setSocketOption</code> to assign buffer sizes * is a hint to the platform of the sizes to set the underlying * network I/O buffers. * Calling <code>getSocketOption</code> can be used to see what * sizes the system is using. * The system MAY adjust the buffer sizes to account for * better throughput available from Maximum Transmission Unit * (MTU) and Maximum Segment Size (MSS) data available * from current network information. * </P> * * @param option socket option identifier (KEEPALIVE, LINGER, * SNDBUF, RCVBUF, or DELAY) * @param value numeric value for specified option * @exception IllegalArgumentException if the value is not * valid (e.g. negative value) or if the option * identifier is not valid * @exception IOException if the connection was closed * * @see #getSocketOption */ public void setSocketOption(byte option, int value) throws IllegalArgumentException, IOException; /** * Get a socket option for the connection. * * @param option socket option identifier (KEEPALIVE, LINGER, * SNDBUF, RCVBUF, or DELAY) * @return numeric value for specified option or -1 if the * value is not available. * @exception IllegalArgumentException if the option identifier is * not valid * @exception IOException if the connection was closed * @see #setSocketOption */ public int getSocketOption(byte option) throws IllegalArgumentException, IOException; /** * Gets the local address to which the socket is bound. * * <P>The host address(IP number) that can be used to connect to this * end of the socket connection from an external system. * Since IP addresses may be dynamically assigned, a remote application * will need to be robust in the face of IP number reasssignment.</P> * <P> The local hostname (if available) can be accessed from * <code> System.getProperty("microedition.hostname")</code> * </P> * * @return the local address to which the socket is bound. * @exception IOException if the connection was closed. * @see ServerSocketConnection */ public String getLocalAddress() throws IOException; /** * Returns the local port to which this socket is bound. * * @return the local port number to which this socket is connected. * @exception IOException if the connection was closed. * @see ServerSocketConnection */ public int getLocalPort() throws IOException; /** * Gets the remote address to which the socket is bound. * The address can be either the remote host name or the IP * address(if available). * * @return the remote address to which the socket is bound. * @exception IOException if the connection was closed. */ public String getAddress() throws IOException; /** * Returns the remote port to which this socket is bound. * * @return the remote port number to which this socket is connected. * @exception IOException if the connection was closed. */ public int getPort() throws IOException;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -