IT. Expert System.

Android Reference

SocketImpl


java.net

Class SocketImpl

  • All Implemented Interfaces:
    SocketOptions
    Direct Known Subclasses:
    PlainSocketImpl


    public abstract class SocketImpl
    extends Object
    implements SocketOptions
    This class is the base of all streaming socket implementation classes. Streaming sockets are wrapped by two classes, ServerSocket and Socket at the server and client end of a connection. At the server, there are two types of sockets engaged in communication, the ServerSocket on a well known port (referred to as listener) used to establish a connection and the resulting Socket (referred to as host).
    • Field Detail

      • address

        protected InetAddress address
        The remote address this socket is connected to.
      • port

        protected int port
        The remote port this socket is connected to.
      • localport

        protected int localport
        The local port this socket is connected to.
    • Constructor Detail

      • SocketImpl

        public SocketImpl()
    • Method Detail

      • accept

        protected abstract void accept(SocketImpl newSocket)
                                throws IOException
        Waits for an incoming request and blocks until the connection is opened on the given socket.
        Parameters:
        newSocket - the socket to accept connections on.
        Throws:
        IOException - if an error occurs while accepting a new connection.
      • available

        protected abstract int available()
                                  throws IOException
        Returns the available number of bytes which are readable from this socket without blocking.
        Returns:
        the number of bytes that may be read without blocking.
        Throws:
        IOException - if an error occurs while reading the number of bytes.
      • bind

        protected abstract void bind(InetAddress address,
                int port)
                              throws IOException
        Binds this socket to the specified local host address and port number.
        Parameters:
        address - the local machine address to bind this socket to.
        port - the port on the local machine to bind this socket to.
        Throws:
        IOException - if an error occurs while binding this socket.
      • close

        protected abstract void close()
                               throws IOException
        Closes this socket. This makes later access invalid.
        Throws:
        IOException - if an error occurs while closing this socket.
      • connect

        protected abstract void connect(String host,
                   int port)
                                 throws IOException
        Connects this socket to the specified remote host and port number.
        Parameters:
        host - the remote host this socket has to be connected to.
        port - the remote port on which this socket has to be connected.
        Throws:
        IOException - if an error occurs while connecting to the remote host.
      • connect

        protected abstract void connect(InetAddress address,
                   int port)
                                 throws IOException
        Connects this socket to the specified remote host address and port number.
        Parameters:
        address - the remote host address this socket has to be connected to.
        port - the remote port on which this socket has to be connected.
        Throws:
        IOException - if an error occurs while connecting to the remote host.
      • create

        protected abstract void create(boolean isStreaming)
                                throws IOException
        Creates a new unconnected socket. The argument isStreaming defines whether the new socket is a streaming or a datagram socket.
        Parameters:
        isStreaming - defines whether the type of the new socket is streaming or datagram.
        Throws:
        IOException - if an error occurs while creating the socket.
      • getFileDescriptor

        protected FileDescriptor getFileDescriptor()
        Gets the file descriptor of this socket.
        Returns:
        the file descriptor of this socket.
      • getInetAddress

        protected InetAddress getInetAddress()
        Gets the remote address this socket is connected to.
        Returns:
        the remote address of this socket.
      • getInputStream

        protected abstract InputStream getInputStream()
                                               throws IOException
        Gets the input stream of this socket.
        Returns:
        the input stream of this socket.
        Throws:
        IOException - if an error occurs while accessing the input stream.
      • getLocalPort

        protected int getLocalPort()
        Gets the local port number of this socket. The field is initialized to -1 and upon demand will go to the IP stack to get the bound value. See the class comment for the context of the local port.
        Returns:
        the local port number this socket is bound to.
      • getOutputStream

        protected abstract OutputStream getOutputStream()
                                                 throws IOException
        Gets the output stream of this socket.
        Returns:
        the output stream of this socket.
        Throws:
        IOException - if an error occurs while accessing the output stream.
      • getPort

        protected int getPort()
        Gets the remote port number of this socket. This value is not meaningful when this instance is wrapped by a ServerSocket.
        Returns:
        the remote port this socket is connected to.
      • listen

        protected abstract void listen(int backlog)
                                throws IOException
        Listens for connection requests on this streaming socket. Incoming connection requests are queued up to the limit specified by backlog. Additional requests are rejected. This method may only be invoked on stream sockets.
        Parameters:
        backlog - the maximum number of outstanding connection requests.
        Throws:
        IOException - if an error occurs while listening.
      • toString

        public String toString()
        Returns a string containing a concise, human-readable description of the socket.
        Overrides:
        toString in class Object
        Returns:
        the textual representation of this socket.
      • shutdownInput

        protected void shutdownInput()
                              throws IOException
        Closes the input channel of this socket.

        This default implementation always throws an IOException to indicate that the subclass should have overridden this method.

        Throws:
        IOException - always because this method should be overridden.
      • shutdownOutput

        protected void shutdownOutput()
                               throws IOException
        Closes the output channel of this socket.

        This default implementation always throws an IOException to indicate that the subclass should have overridden this method.

        Throws:
        IOException - always because this method should be overridden.
      • connect

        protected abstract void connect(SocketAddress remoteAddr,
                   int timeout)
                                 throws IOException
        Connects this socket to the remote host address and port number specified by the SocketAddress object with the given timeout. This method will block indefinitely if the timeout is set to zero.
        Parameters:
        remoteAddr - the remote host address and port number to connect to.
        timeout - the timeout value in milliseconds.
        Throws:
        IOException - if an error occurs while connecting.
      • supportsUrgentData

        protected boolean supportsUrgentData()
        Returns whether the socket supports urgent data or not. Subclasses should override this method.
        Returns:
        false because subclasses must override this method.
      • sendUrgentData

        protected abstract void sendUrgentData(int value)
                                        throws IOException
        Sends the single byte of urgent data on the socket.
        Parameters:
        value - the byte of urgent data.
        Throws:
        IOException - if an error occurs sending urgent data.
      • setPerformancePreferences

        protected void setPerformancePreferences(int connectionTime,
                                     int latency,
                                     int bandwidth)
        Sets performance preference for connection time, latency and bandwidth. Does nothing by default.
        Parameters:
        connectionTime - the importance of connect time.
        latency - the importance of latency.
        bandwidth - the importance of bandwidth.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 61 / 158680520. Delta: 0.03976 с