Package 

Class StunServerTransaction

  • All Implemented Interfaces:

    
    public class StunServerTransaction
    
                        

    A STUN client retransmits requests as specified by the protocol. Once formulated and sent, the client sends the Binding Request. Reliability is accomplished through request retransmissions. The ClientTransaction retransmits the request starting with an interval of 100ms, doubling every retransmit until the interval reaches 1.6s. Retransmissions continue with intervals of 1.6s until a response is received, or a total of 9 requests have been sent. If no response is received by 1.6 seconds after the last request has been sent, the client SHOULD consider the transaction to have failed. In other words, requests would be sent at times 0ms, 100ms, 300ms, 700ms, 1500ms, 3100ms, 4700ms, 6300ms, and 7900ms. At 9500ms, the client considers the transaction to have failed if no response has been received. A server transaction is therefore responsible for retransmitting the same response that was saved for the original request, and not let any retransmissions go through to the user application.

    • Constructor Detail

      • StunServerTransaction

        StunServerTransaction(StunStack stackCallback, TransactionID tranID, TransportAddress localListeningAddress, TransportAddress requestSource)
        Creates a server transaction
        Parameters:
        stackCallback - the stack that created us.
        tranID - the transaction id contained by the request that was the cause for this transaction.
        localListeningAddress - the TransportAddress that this transaction is receiving requests on.
        requestSource - the TransportAddress that this transaction is receiving requests from.
    • Method Detail

      • isRetransmitting

         boolean isRetransmitting()

        Specifies whether this server transaction is in the retransmitting state. Or in other words - has it already sent a first response or not?

      • start

         synchronized void start()

        Start the transaction. This launches the countdown to the moment the transaction would expire.

      • sendResponse

         void sendResponse(Response response, TransportAddress sendThrough, TransportAddress sendTo)

        Sends the specified response through the sendThrough NetAccessPoint descriptor to the specified destination and changes the transaction's state to retransmitting.

        Parameters:
        response - the response to send the transaction to.
        sendThrough - the local address through which responses are to be sent
        sendTo - the destination for responses of this transaction.
      • expire

         synchronized void expire()

        Cancels the transaction. Once this method is called the transaction is considered terminated and will stop retransmissions.

      • isExpired

         boolean isExpired()

        Determines whether this StunServerTransaction is expired now.

      • isExpired

         synchronized boolean isExpired(long now)

        Determines whether this StunServerTransaction will be expired at a specific point in time.

        Parameters:
        now - the time in milliseconds at which the expired state of this StunServerTransaction is to be returned