IT. Expert System.

Android Reference

LinkSocket


android.net

Class LinkSocket



  • public class LinkSocket
    extends Socket
    • Constructor Detail

      • LinkSocket

        public LinkSocket()
        Default constructor
      • LinkSocket

        public LinkSocket(LinkSocketNotifier notifier)
        Creates a new unconnected socket.
        Parameters:
        notifier - a reference to a class that implements LinkSocketNotifier
      • LinkSocket

        public LinkSocket(LinkSocketNotifier notifier,
                  Proxy proxy)
        Creates a new unconnected socket usign the given proxy type.
        Parameters:
        notifier - a reference to a class that implements LinkSocketNotifier
        proxy - the specified proxy for this socket
        Throws:
        IllegalArgumentException - if the argument proxy is null or of an invalid type.
        SecurityException - if a security manager exists and it denies the permission to connect to the given proxy.
    • Method Detail

      • getLinkProperties

        public LinkProperties getLinkProperties()
        Returns:
        the LinkProperties for the socket
      • setNeededCapabilities

        public boolean setNeededCapabilities(LinkCapabilities needs)
        Set the LinkCapabilies needed for this socket. If the socket is already connected or is a duplicate socket the request is ignored and false will be returned. A needs map can be created via the createNeedsMap static method.
        Parameters:
        needs - the needs of the socket
        Returns:
        true if needs are successfully set, false otherwise
      • getNeededCapabilities

        public LinkCapabilities getNeededCapabilities()
        Returns:
        the LinkCapabilites set by setNeededCapabilities, empty if none has been set
      • getCapabilities

        public LinkCapabilities getCapabilities()
        Returns:
        all of the LinkCapabilities of the link used by this socket
      • getCapabilities

        public LinkCapabilities getCapabilities(Set<Integer> capabilities)
        Returns this LinkSockets set of capabilities, filtered according to the given Set. Capabilities in the Set but not available from the link will not be reported in the results. Capabilities of the link but not listed in the Set will also not be reported in the results.
        Parameters:
        capabilities - Set of capabilities requested
        Returns:
        the filtered LinkCapabilities of this LinkSocket, may be empty
      • setTrackedCapabilities

        public void setTrackedCapabilities(Set<Integer> capabilities)
        Provide the set of capabilities the application is interested in tracking for this LinkSocket.
        Parameters:
        capabilities - a Set of capabilities to track
      • getTrackedCapabilities

        public Set<Integer> getTrackedCapabilities()
        Returns:
        the LinkCapabilities that are tracked, empty if none has been set.
      • connect

        public void connect(String dstName,
                   int dstPort,
                   int timeout)
                     throws UnknownHostException,
                            IOException,
                            SocketTimeoutException
        Connects this socket to the given remote host address and port specified by dstName and dstPort.
        Parameters:
        dstName - the address of the remote host to connect to
        dstPort - the port to connect to on the remote host
        timeout - the timeout value in milliseconds or 0 for infinite timeout
        Throws:
        UnknownHostException - if the given dstName is invalid
        IOException - if the socket is already connected or an error occurs while connecting
        SocketTimeoutException - if the timeout fires
      • connect

        public void connect(String dstName,
                   int dstPort)
                     throws UnknownHostException,
                            IOException
        Connects this socket to the given remote host address and port specified by dstName and dstPort.
        Parameters:
        dstName - the address of the remote host to connect to
        dstPort - the port to connect to on the remote host
        Throws:
        UnknownHostException - if the given dstName is invalid
        IOException - if the socket is already connected or an error occurs while connecting
      • connect

        @Deprecated
        public void connect(SocketAddress remoteAddr,
                              int timeout)
                     throws IOException,
                            SocketTimeoutException
        Deprecated. Use connect(String dstName, int dstPort, int timeout) instead. Using this method may result in reduced functionality.
        Connects this socket to the given remote host address and port specified by the SocketAddress with the specified timeout.
        Overrides:
        connect in class Socket
        Parameters:
        remoteAddr - the address and port of the remote host to connect to
        timeout - the timeout value in milliseconds or 0 for an infinite timeout.
        Throws:
        IllegalArgumentException - if the given SocketAddress is invalid
        IOException - if the socket is already connected or an error occurs while connecting
        SocketTimeoutException - if the timeout expires
      • connect

        @Deprecated
        public void connect(SocketAddress remoteAddr)
                     throws IOException
        Deprecated. Use connect(String dstName, int dstPort) Using this method may result in reduced functionality.
        Connects this socket to the given remote host address and port specified by the SocketAddress. TODO add comment on all these that the network selection happens during connect and may take 30 seconds
        Overrides:
        connect in class Socket
        Parameters:
        remoteAddr - the address and port of the remote host to connect to.
        Throws:
        IllegalArgumentException - if the SocketAddress is invalid or not supported.
        IOException - if the socket is already connected or an error occurs while connecting
      • connect

        public void connect(int timeout)
                     throws IOException
        Connect a duplicate socket socket to the same remote host address and port as the original with a timeout parameter.
        Parameters:
        timeout - the timeout value in milliseconds or 0 for infinite timeout
        Throws:
        IOException - if the socket is already connected or an error occurs while connecting
      • connect

        public void connect()
                     throws IOException
        Connect a duplicate socket socket to the same remote host address and port as the original.
        Throws:
        IOException - if the socket is already connected or an error occurs while connecting
      • close

        public void close()
                   throws IOException
        Closes the socket. It is not possible to reconnect or rebind to this socket thereafter which means a new socket instance has to be created.
        Overrides:
        close in class Socket
        Throws:
        IOException - if an error occurs while closing the socket
      • requestNewLink

        public void requestNewLink(LinkSocket.LinkRequestReason linkRequestReason)
        Request that a new LinkSocket be created using a different radio (such as WiFi or 3G) than the current LinkSocket. If a different radio is available a call back will be made via onBetterLinkAvail. If unable to find a better radio, application will be notified via onNewLinkUnavailable
        Parameters:
        linkRequestReason - reason for requesting a new link.
        See Also:
        LinkSocketNotifier.onBetterLinkAvailable(LinkSocket, LinkSocket)
      • bind

        @Deprecated
        public void bind(SocketAddress localAddr)
                  throws UnsupportedOperationException
        Deprecated. LinkSocket will automatically pick the optimum interface to bind to
        Description copied from class: Socket
        Binds this socket to the given local host address and port specified by the SocketAddress localAddr. If localAddr is set to null, this socket will be bound to an available local address on any free port.
        Overrides:
        bind in class Socket
        Parameters:
        localAddr - the specific address and port on the local machine to bind to
        Throws:
        IOException - always as this method is deprecated for LinkSocket
        UnsupportedOperationException
      • log

        protected static void log(String s)
        Debug logging


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: 402 / 158856316. Delta: 0.03928 с