Package 

Class PseudoTcpSocket

  • All Implemented Interfaces:
    java.io.Closeable , java.lang.AutoCloseable

    
    public class PseudoTcpSocket
    extends Socket
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      long getConversationID()
      void setConversationID(long convID) Set conversation ID for the socket Must be called on unconnected socket
      void setMTU(int mtu) Sets MTU (maximum transmission unit) value
      int getMTU() Gets MTU (maximum transmission unit) value
      long getOption(Option option) Sets an Option on this socket.
      void setOption(Option option, long optValue)
      void accept(int timeout) Blocking method waits for connection.
      void setDebugName(String debugName) Sets debug name that will be displayed in log messages for this socket
      PseudoTcpState getState() Returns current PseudoTcpState of this socket
      boolean isConnected()
      boolean isConnecting()
      boolean isClosed()
      void connect(SocketAddress endpoint) Connects without the timeout.
      void connect(SocketAddress remoteAddr, int timeout) On Android, we must not use the default connect implementation, because that one deals directly with physical resources, while we create a socket on top of another socket.
      synchronized void close()
      OutputStream getOutputStream()
      void accept(SocketAddress remoteAddress, int timeout) Allows to set up the remote address directly.
      FileDescriptor getFileDescriptor() Return the FileDescriptor of the underlying socket.
      • Methods inherited from class java.net.Socket

        bind, getChannel, getInetAddress, getInputStream, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOption, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setOption, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setSoTimeout, setSocketImplFactory, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, supportedOptions, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • setConversationID

         void setConversationID(long convID)

        Set conversation ID for the socket Must be called on unconnected socket

        Parameters:
        convID - the conversation ID to set
      • setMTU

         void setMTU(int mtu)

        Sets MTU (maximum transmission unit) value

        Parameters:
        mtu - the MTU value
      • getMTU

         int getMTU()

        Gets MTU (maximum transmission unit) value

      • getOption

         long getOption(Option option)

        Sets an Option on this socket.

        Parameters:
        option - the option to set on this socket.
      • setOption

         void setOption(Option option, long optValue)
        Parameters:
        option - PseudoTCP option to set
        optValue - option's value
      • accept

         void accept(int timeout)

        Blocking method waits for connection.

        Parameters:
        timeout - for this operation in ms
      • setDebugName

         void setDebugName(String debugName)

        Sets debug name that will be displayed in log messages for this socket

        Parameters:
        debugName - the name of this socket for debug messages
      • connect

         void connect(SocketAddress remoteAddr, int timeout)

        On Android, we must not use the default connect implementation, because that one deals directly with physical resources, while we create a socket on top of another socket.

      • close

         synchronized void close()
      • accept

         void accept(SocketAddress remoteAddress, int timeout)

        Allows to set up the remote address directly. Otherwise, when using the other accept methods, the first address from which a packet is received, is considered the remote address.

        Parameters:
        remoteAddress - the one and only remote address that will be accepted as remote packet's source
        timeout - connection accept timeout value in milliseconds, after which the exception will be thrown.