亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? stunservertransaction.java

?? stun的java實現
?? JAVA
字號:
/*
 * Stun4j, the OpenSource Java Solution for NAT and Firewall Traversal.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package net.java.stun4j.stack;

import java.util.TimerTask;
import net.java.stun4j.message.Request;
import net.java.stun4j.NetAccessPointDescriptor;
import net.java.stun4j.ResponseCollector;
import net.java.stun4j.*;
import net.java.stun4j.message.*;

/**
 * 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.
 *
 * <p>Organisation: <p> Louis Pasteur University, Strasbourg, France</p>
 * <p>Network Research Team (http://www-r2.u-strasbg.fr)</p></p>
 * @author Emil Ivov
 * @version 0.1
 */

class StunServerTransaction
    implements Runnable
{
    /**
     * The time that we keep server transactions active.
     */
    private long transactionLifetime = 16000;

    /**
     * The StunProvider that created us.
     */
    private StunProvider      providerCallback  = null;

    /**
     * The source of the transaction request.
     */
    private StunAddress responseDestination = null;

    /**
     * The response sent in response to the request.
     */
    private Response response = null;

    /**
     * The ap descriptor used when sending the response
     */
    private NetAccessPointDescriptor apDescriptor = null;

    /**
     * The id of the transaction.
     */
    private TransactionID    transactionID      = null;

    /**
     * The date (in millis) when the next retransmission should follow.
     */
    private long expirationDate = -1;

    /**
     * The thread that this transaction runs in.
     */
    private Thread runningThread = null;

    /**
     * Determines whether or not the transaction has expired.
     */
    private boolean expired = true;

    /**
     * Determines whether or not the transaction is in a retransmitting state.
     * In other words whether a response has already been sent once to the
     * transaction request.
     */
    private boolean isRetransmitting = false;

    /**
     * Creates a server transaction
     * @param providerCallback the provider that created us.
     * @param tranID the transaction id contained by the request that was the
     * cause for this transaction.
     */
    public StunServerTransaction(StunProvider            providerCallback,
                                 TransactionID           tranID)
    {
        this.providerCallback  = providerCallback;

        this.transactionID = tranID;

        runningThread = new Thread(this);
    }

    /**
     * Start the transaction. This launches the countdown to the moment the
     * transaction would expire.
     */
    public void start()
    {
        expired = false;
        runningThread.start();
    }

    /**
     * Actually this method is simply a timer waiting for the server transaction
     * lifetime to come to an end.
     */
    public void run()
    {
        runningThread.setName("ServTran");

        schedule(transactionLifetime);
        waitNextScheduledDate();

        //let's get lost
        expire();
        providerCallback.removeServerTransaction(this);
    }

    /**
     * Sends the specified response through the <code>sendThrough</code>
     * NetAccessPoint descriptor to the specified destination and changes
     * the transaction's state to retransmitting.
     *
     * @param response the response to send the transaction to.
     * @param sendThrough the NetAccessPoint through which the response is to
     * be sent
     * @param sendTo the destination of the response.
     *
     * @throws StunException if sending this response fails for some reason.
     */
    void sendResponse(Response response,
                      NetAccessPointDescriptor sendThrough,
                      StunAddress sendTo)
        throws StunException
    {
        if(!isRetransmitting){
            this.response = response;
            //the transaction id might already have been set, but its our job
            //to make sure of that
            response.setTransactionID(this.transactionID.getTransactionID());
            this.apDescriptor = sendThrough;
            this.responseDestination = sendTo;
        }

        isRetransmitting = true;
        retransmitResponse();
    }

    /**
     * Retransmits the response that was originally sent to the request that
     * caused this transaction.
     * @throws StunException
     */
    void retransmitResponse()
        throws StunException
    {
        //don't retransmit if we are expired or if the user application
        //hasn't yet transmitted a first response
        if(expired || !isRetransmitting)
            return;

        providerCallback.getNetAccessManager().sendMessage(response,
                                                           apDescriptor,
                                                           responseDestination);
    }

    /**
     * Waits until next retransmission is due or until the transaction is
     * cancelled (whichever comes first).
     */
    synchronized void waitNextScheduledDate()
    {
        long current = System.currentTimeMillis();
        while(expirationDate - current > 0)
        {
            try
            {
                wait(expirationDate - current);
            }
            catch (InterruptedException ex)
            {
            }

            //did someone ask us to get lost?
            if(expired)
                return;
            current = System.currentTimeMillis();
        }
    }

    /**
     * Sets the expiration date for this server transaction.
     * @param timeout the number of millis to wait before expiration.
     */
    void schedule(long timeout)
    {
        this.expirationDate = System.currentTimeMillis() + timeout;
    }

    /**
     * Cancels the transaction. Once this method is called the transaction is
     * considered terminated and will stop retransmissions.
     */
    synchronized void expire()
    {
        this.expired = true;
        notifyAll();
    }


    /**
     * Returns the ID of the current transaction.
     *
     * @return the ID of the transaction.
     */
    TransactionID getTransactionID()
    {
        return this.transactionID;
    }

    /**
     * Specifies whether this server transaction is in the retransmitting state.
     * Or in other words - has it already sent a first response or not?
     * @return boolean
     */
    boolean isReransmitting()
    {
        return isRetransmitting;
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品乱码久久久久久按摩| 亚洲欧美综合网| 久久精品国产澳门| 久久精品夜色噜噜亚洲aⅴ| 波多野结衣中文字幕一区| 亚洲综合激情小说| 久久久午夜精品| 欧美日韩一区视频| 成人福利电影精品一区二区在线观看 | 精品盗摄一区二区三区| 91网站黄www| 久久99精品国产91久久来源| 国产精品欧美久久久久无广告| 欧美日韩免费不卡视频一区二区三区| 久久电影网电视剧免费观看| 一区二区三区高清不卡| 国产精品免费网站在线观看| 欧美不卡激情三级在线观看| 日韩综合小视频| 午夜精品久久久久久久99水蜜桃 | 一本色道a无线码一区v| 国产一区二区三区在线观看免费| 亚洲午夜久久久| 亚洲天堂a在线| 夜夜亚洲天天久久| 亚洲一区二区成人在线观看| 亚洲综合999| 久久精品999| 久久精品国产久精国产| 成人午夜在线视频| 欧美日韩国产精选| 欧美嫩在线观看| 久久综合999| 最新欧美精品一区二区三区| 亚洲免费在线观看| 亚洲电影欧美电影有声小说| 蜜桃视频一区二区三区在线观看| 久久99久久精品| 成人av免费网站| 7777女厕盗摄久久久| 久久久噜噜噜久久中文字幕色伊伊| 中国色在线观看另类| 亚洲成人av一区二区| 国产伦精品一区二区三区免费迷| 91在线视频免费91| 777a∨成人精品桃花网| 亚洲欧美日韩国产综合在线| 天堂影院一区二区| 色综合网色综合| 欧美成人video| 日韩电影在线观看电影| 99热在这里有精品免费| 欧美变态tickle挠乳网站| 亚洲蜜臀av乱码久久精品蜜桃| 久久99精品久久久久久| 9191久久久久久久久久久| 一区二区三区四区激情| 国产91精品一区二区麻豆亚洲| 日韩亚洲欧美中文三级| 亚洲福中文字幕伊人影院| 91在线无精精品入口| 中文字幕一区二区三中文字幕| 国产精品996| 国产精品免费视频观看| 国产精品麻豆久久久| 国产午夜三级一区二区三| 蜜臀va亚洲va欧美va天堂| 欧美电影在哪看比较好| 日韩国产成人精品| 欧美一级高清片在线观看| 青青草97国产精品免费观看无弹窗版 | 亚洲男人的天堂在线观看| jlzzjlzz欧美大全| 亚洲欧美日韩一区二区| 91九色02白丝porn| 亚洲国产欧美另类丝袜| 色婷婷av一区二区三区大白胸 | 色婷婷av一区二区三区gif| 肉色丝袜一区二区| 91久久免费观看| 日韩av一级电影| 2020国产精品| 色激情天天射综合网| 日产国产欧美视频一区精品 | 欧美精品久久99久久在免费线 | 久久成人av少妇免费| 国产日韩欧美激情| 777奇米四色成人影色区| www.av精品| 麻豆精品一区二区| 亚洲黄色免费网站| 久久久精品日韩欧美| 欧美在线观看禁18| 成人免费视频caoporn| 日韩中文字幕一区二区三区| 日韩毛片在线免费观看| 精品国产一区二区亚洲人成毛片| 色哟哟精品一区| av一区二区三区在线| 久久精品国产精品青草| 亚洲成人黄色小说| 成人欧美一区二区三区小说| 久久综合给合久久狠狠狠97色69| 欧美精品一卡二卡| 色婷婷综合在线| 91视频免费播放| www.日韩大片| 欧美制服丝袜第一页| 色综合久久九月婷婷色综合| 国产成都精品91一区二区三| 国产毛片精品国产一区二区三区| 蜜桃91丨九色丨蝌蚪91桃色| 美女一区二区三区在线观看| 秋霞电影网一区二区| 国产精品亚洲第一区在线暖暖韩国| 国内精品久久久久影院色| 激情综合亚洲精品| 成人中文字幕在线| 97久久超碰精品国产| 欧美老女人第四色| 欧美成人高清电影在线| 国产欧美日韩在线看| 亚洲国产日韩a在线播放| 免费在线观看一区二区三区| 国产一区二区三区四| 一本色道**综合亚洲精品蜜桃冫| 91电影在线观看| 精品国产一区a| 综合自拍亚洲综合图不卡区| 亚洲另类在线制服丝袜| 日韩一区欧美二区| 国产99精品国产| 91精品国产综合久久香蕉麻豆| 国产香蕉久久精品综合网| 一区二区三区美女视频| 国产一区二区女| 国产精品少妇自拍| 麻豆专区一区二区三区四区五区| www.66久久| 国产精品色在线观看| 国产精品自在在线| 91精品国产免费久久综合| 亚洲人成人一区二区在线观看| 国产精华液一区二区三区| 欧美一级黄色片| 午夜精品久久久久久久久久久| 91亚洲精品一区二区乱码| 国产精品久久久久久久久搜平片 | 亚洲影视在线观看| 欧美日韩精品专区| 亚洲午夜日本在线观看| 在线观看亚洲一区| 亚洲国产成人porn| 欧美亚洲综合在线| 亚洲一区二区三区四区中文字幕| 99re这里只有精品6| 亚洲丝袜另类动漫二区| 色婷婷综合久久久久中文一区二区 | 成人av网在线| 日本午夜精品一区二区三区电影| 色久综合一二码| 天天综合网 天天综合色| 91精品国产综合久久精品app | 亚洲欧美激情视频在线观看一区二区三区 | 香港成人在线视频| 精品剧情在线观看| 丰满放荡岳乱妇91ww| 亚洲精品国产视频| 日韩欧美在线影院| 懂色av中文一区二区三区| 一区二区三区在线视频观看| 日韩一区二区三区观看| 成人开心网精品视频| 性做久久久久久免费观看欧美| 久久天天做天天爱综合色| 99久久免费国产| 男人的天堂亚洲一区| 亚洲免费在线播放| 欧美国产1区2区| 欧美videofree性高清杂交| 一本久久a久久精品亚洲| 精品中文字幕一区二区| 亚洲成人动漫精品| 1区2区3区欧美| 国产精品污www在线观看| 2024国产精品| 欧美精品黑人性xxxx| 欧美日韩不卡在线| 一本色道a无线码一区v| 99久久久国产精品| 国产一区二区0| 国产成人一区二区精品非洲| 美女视频黄a大片欧美| 秋霞影院一区二区| 免费在线观看日韩欧美| 奇米综合一区二区三区精品视频| 亚洲成av人片在线观看无码| 亚洲国产成人va在线观看天堂| 亚洲欧洲制服丝袜| 日韩专区中文字幕一区二区|