-
- All Implemented Interfaces:
public class StunServerTransactionA 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.
-
-
Field Summary
Fields Modifier and Type Field Description private final TransportAddresslocalListeningAddressprivate final TransactionIDtransactionIDprivate booleanisRetransmitting
-
Constructor Summary
Constructors Constructor Description StunServerTransaction(StunStack stackCallback, TransactionID tranID, TransportAddress localListeningAddress, TransportAddress requestSource)Creates a server transaction
-
Method Summary
Modifier and Type Method Description TransportAddressgetLocalListeningAddress()Returns the local TransportAddress that this transaction is receiving requests on. TransactionIDgetTransactionID()Returns the ID of the current transaction. booleanisRetransmitting()Specifies whether this server transaction is in the retransmitting state. synchronized voidstart()Start the transaction. voidsendResponse(Response response, TransportAddress sendThrough, TransportAddress sendTo)Sends the specified response through the sendThroughNetAccessPoint descriptor to the specified destination and changes the transaction's state to retransmitting.synchronized voidexpire()Cancels the transaction. booleanisExpired()Determines whether this StunServerTransaction is expired now. synchronized booleanisExpired(long now)Determines whether this StunServerTransaction will be expired at a specific point in time. TransportAddressgetSendingAddress()Returns the local TransportAddress that this transaction is sending responses from. TransportAddressgetResponseDestinationAddress()Returns the remote TransportAddress that this transaction is receiving requests from. TransportAddressgetRequestSourceAddress()Returns the remote TransportAddress that this transaction is receiving requests from. -
-
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
-
getLocalListeningAddress
TransportAddress getLocalListeningAddress()
Returns the local TransportAddress that this transaction is receiving requests on.
-
getTransactionID
TransactionID getTransactionID()
Returns the ID of the current transaction.
-
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
sendThroughNetAccessPoint 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 sentsendTo- 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
-
getSendingAddress
TransportAddress getSendingAddress()
Returns the local TransportAddress that this transaction is sending responses from.
-
getResponseDestinationAddress
TransportAddress getResponseDestinationAddress()
Returns the remote TransportAddress that this transaction is receiving requests from.
-
getRequestSourceAddress
TransportAddress getRequestSourceAddress()
Returns the remote TransportAddress that this transaction is receiving requests from.
-
-
-
-