Interface I2PSocket

    • Method Detail

      • getThisDestination

        Destination getThisDestination()
        Returns:
        the Destination of this side of the socket.
      • getPeerDestination

        Destination getPeerDestination()
        Returns:
        the destination of the peer.
      • setOptions

        void setOptions​(I2PSocketOptions options)
        Configure the socket
        Parameters:
        options - I2PSocketOptions to set
      • getReadTimeout

        long getReadTimeout()
        How long we will wait blocked on a read() operation. This is simply a helper to query the I2PSocketOptions
        Returns:
        milliseconds to wait, or -1 if we will wait indefinitely
      • setReadTimeout

        void setReadTimeout​(long ms)
        Define how long we will wait blocked on a read() operation (-1 will make the socket wait forever). This is simply a helper to adjust the I2PSocketOptions
        Parameters:
        ms - timeout in ms
      • isClosed

        boolean isClosed()
      • getPort

        int getPort()
        The remote port.
        Returns:
        Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)
        Since:
        0.8.9
      • getLocalPort

        int getLocalPort()
        The local port.
        Returns:
        Default I2PSession.PORT_UNSPECIFIED (0) or PORT_ANY (0)
        Since:
        0.8.9
      • reset

        void reset()
            throws IOException
        Resets and closes this socket. Sends a RESET indication to the far-end. This is the equivalent of setSoLinger(true, 0) followed by close() on a Java Socket. Nonblocking. Any thread currently blocked in an I/O operation upon this socket will throw an IOException. Once a socket has been reset, it is not available for further networking use (i.e. can't be reconnected or rebound). A new socket needs to be created. Resetting this socket will also close the socket's InputStream and OutputStream.
        Throws:
        IOException
        Since:
        0.9.30