eWON JTK
javax.microedition.io

Interface SocketConnection

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static byte DELAY
      Socket option for the small buffer writing delay (0).
      static byte KEEPALIVE
      Socket option for the keep alive feature (2).
      static byte LINGER
      Socket option for the linger time to wait in seconds before closing a connection with pending data output (1).
      static byte RCVBUF
      Socket option for the size of the receiving buffer (3).
      static byte SNDBUF
      Socket option for the size of the sending buffer (4).
    • Field Detail

      • DELAY

        static final byte DELAY
        Socket option for the small buffer writing delay (0). Set to zero to disable Nagle algorithm for small buffer operations. Set to a non-zero value to enable.
        See Also:
        Constant Field Values
      • LINGER

        static final byte LINGER
        Socket option for the linger time to wait in seconds before closing a connection with pending data output (1). Setting the linger time to zero disables the linger wait interval.
        See Also:
        Constant Field Values
      • KEEPALIVE

        static final byte KEEPALIVE
        Socket option for the keep alive feature (2). Setting KEEPALIVE to zero will disable the feature. Setting KEEPALIVE to a non-zero value will enable the feature.
        See Also:
        Constant Field Values
      • RCVBUF

        static final byte RCVBUF
        Socket option for the size of the receiving buffer (3).
        See Also:
        Constant Field Values
      • SNDBUF

        static final byte SNDBUF
        Socket option for the size of the sending buffer (4).
        See Also:
        Constant Field Values
    • Method Detail

      • setSocketOption

        void setSocketOption(byte option,
                           int value)
                             throws IllegalArgumentException,
                                    IOException
        Set a socket option for the connection.

        Options inform the low level networking code about intended usage patterns that the application will use in dealing with the socket connection.

        Calling setSocketOption to assign buffer sizes is a hint to the platform of the sizes to set the underlying network I/O buffers. Calling getSocketOption 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.

        Parameters:
        option - socket option identifier (KEEPALIVE, LINGER, SNDBUF, RCVBUF, or DELAY)
        value - numeric value for specified option
        Throws:
        IllegalArgumentException - if the value is not valid (e.g. negative value) or if the option identifier is not valid
        IOException - if the connection was closed
        See Also:
        getSocketOption(byte)
      • getLocalAddress

        String getLocalAddress()
                               throws IOException
        Gets the local address to which the socket is bound.

        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.

        The local hostname (if available) can be accessed from System.getProperty("microedition.hostname")

        Returns:
        the local address to which the socket is bound.
        Throws:
        IOException - if the connection was closed.
        See Also:
        ServerSocketConnection
      • getLocalPort

        int getLocalPort()
                         throws IOException
        Returns the local port to which this socket is bound.
        Returns:
        the local port number to which this socket is connected.
        Throws:
        IOException - if the connection was closed.
        See Also:
        ServerSocketConnection
      • getAddress

        String getAddress()
                          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).
        Returns:
        the remote address to which the socket is bound.
        Throws:
        IOException - if the connection was closed.
      • getPort

        int getPort()
                    throws IOException
        Returns the remote port to which this socket is bound.
        Returns:
        the remote port number to which this socket is connected.
        Throws:
        IOException - if the connection was closed.

www.eWON.biz: Your Eyes Watching Over Net