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

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

?? cwtpinitiator.java

?? jwap 協議 udp 可以用于手機通訊
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/** * JWAP - A Java Implementation of the WAP Protocols * Copyright (C) 2001-2004 Niko Bender * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package net.sourceforge.jwap.wtp;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.ByteArrayOutputStream;import java.io.IOException;import java.util.Random;import net.sourceforge.jwap.util.Logger;import net.sourceforge.jwap.wtp.pdu.CWTPAbort;import net.sourceforge.jwap.wtp.pdu.CWTPAck;import net.sourceforge.jwap.wtp.pdu.CWTPInvoke;import net.sourceforge.jwap.wtp.pdu.CWTPPDU;import net.sourceforge.jwap.wtp.pdu.CWTPResult;import net.sourceforge.jwap.wtp.pdu.CWTPSegmResult;import net.sourceforge.jwap.wtp.pdu.EWTPCorruptPDUException;/** * This class implements a WTP state machine of one transaction according * to the WTP specification by the WAP Forum. It uses CWTPManagement to send * the PDUs. CWTPManagement receives PDUs from the remote, decodes them and * calls #process(CWTPPDU pdu) of the corresponding tranaction (this class). * <p> * To be informed of thrown service primitives by this layer, you should * implement the interface IWTPUpperLayer and give it with the constructor. * </p><p> * To construct a service primitive to be processed by this WTP-socket, * use objects of the class CWTPEvent, that implement service primitives. * </p><p> * To Use a whole WAP Stack besides you need the WSP layer, implemented * in package mmsjua.wap.wsp. * </p><p> * <b>Notice</b>, that development is actually in progress. * Most features are implemented but only for Initiator, not for a responder! * (for a definition of these terms refer to the spec, section 3.2.) * </p><p> * <b>Section descriptions</b> used in this class refer to * WTP Specification WAP-224-WTP-20010710-a * by the <a href="http://www.wapforum.org">WAP Forum</a> * </p> * */public class CWTPInitiator implements IWTPTransaction {    private static final byte STATE_NULL = 0x00;    private static final byte STATE_RESULT_WAIT = 0x01;    private static final byte STATE_RESULT_RESP_WAIT = 0x02;    private static final byte STATE_WAIT_TIMEOUT = 0x03;    private static final byte STATE_WAIT_ACK = 0x04;    private static final String[] states = {        "NULL", "RESULT WAIT", "RESULT RESP WAIT", "WAIT TIMEOUT", "WAIT ACK"    };    protected static Logger logger = Logger.getLogger(CWTPInitiator.class);    public static final int RCR_MAX = 3;    public static final int AEC_MAX = 3;    /**     * 9.4.3     * counter to generate unique TIDs     * uint16     */    private static int genTID = -1;    private byte state = 0x00;    // which session does this transaction belong to?    private IWTPUpperLayer upperLayer;    // used to send and receive    private CWTPSocket wtpSocket;    // is this transaction aborted?    private boolean aborted = false;    private short abortCode;    /**     * 5.3.1.7     * Class Type 1, 2 or 3     */    private byte classType;    /**     * 9.4.1     * ack interval     * this sets a bound for the amount of time to wait before sending an acknowledgement.     */    private javax.swing.Timer a_timer;    private int a = 5000;    /**     * 9.4.1     * retry interval     * This sets a bound for the amount of time to wait before re-transmitting a PDU.     */    private javax.swing.Timer r_timer;    private int r = 10000;    /**     * 9.4.1     * wait timeout interval (only class 2 initiator and class 1 responder)     * This sets a bound for the amount of time to wait before state information     * about a transaction is released.     */    private javax.swing.Timer w_timer;    private int w = 5000;    /**     * 7.14.3     * While segmentation each segment has to be acknowledged. This timer     * waits before resending a segment.     */    private javax.swing.Timer s_timer;    private int s = 5000;    private CWTPPDU segment;    private int segment_sended = 1;    private final int segment_sended_max = 4;    /**     * 9.4.2     * re-transmission counter     * acknowledgement expireation counter     */    private int rcr = 0;    private int aec = 0;    /**     * uint16     */    private int sendTID;    private int rcvTID;    private int lastTID;    /**     * recently sent PDU - hold it for retransmission     */    private CWTPPDU sentPDU;    private boolean holdOn = false;    private boolean uack = false;    /**     * next segment to send while in STATE_WAIT_ACK     */    private int segmentIndex = 0;    private ByteArrayOutputStream segdata;    private int segend;    private short seglast;    private int segTID;    //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX    //XXXXXXXXXXXXXXXXXXXXXXX CONSTRUCTOR XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX    /**     * Constructs a CWTPSocket using a DatagramSocket (UDP).     * Even implementing all parameters belonging to according to     * TR-Invoke service primitive (section 5.3.1),     * which are not temporary for one transaction.     * This socket can be used several times by service primitives.     * After all it has to be closed by calling <code>close()</code>     *     * @see #close(short)     * @param to destination address (section 5.3.1.3)     * @param port destination port (section 5.3.1.4)     * @param ackType Ack Type (section 5.3.1.5)     * @param classType Class Type (0, 1 or 2) (section 5.3.1.8)     * @throws IllegalArgumentException     * @throws SocketException     */    public CWTPInitiator(CWTPSocket wtp_Socket, IWTPUpperLayer upper_Layer,        CWTPEvent initPacket, boolean ackType, byte classType) {        init(wtp_Socket, upper_Layer, ackType, classType);        sendTID = CWTPInitiator.generateNewTID();        rcvTID = sendTID - 32768; // rcvTID = sendTID XOR 0x8000        // process the init service primitive        try {            process(initPacket);        } catch (EWTPAbortedException e) {            logger.warn("Event processing aborted", e);        }    }    private void init(CWTPSocket wtp_Socket, IWTPUpperLayer upper_Layer,        boolean ackType, byte classType) throws IllegalArgumentException {        this.upperLayer = upper_Layer;        this.wtpSocket = wtp_Socket;        uack = ackType;        setClassType(classType);        // initialize timer and add actionListener        // see declaration of a_timer above        a_timer = new javax.swing.Timer(a,                new ActionListener() {                    public void actionPerformed(ActionEvent e) {                        a_timer.stop();                        if (state == STATE_RESULT_RESP_WAIT) {                            // check acknowledgement counter                            if (!uack) { // if user acknowledgement is turned off                                // unfortunately I do not remember why I have coded this branch like this.                                logger.error("acknowledgement timer: exceeded " +                                    (aec + 1) + " time(s) --> cancel");                                CWTPAck send = new CWTPAck(sendTID);                                wtpSocket.send(send);                                w_timer.restart();                                setState(STATE_WAIT_TIMEOUT);                            } else if (aec < AEC_MAX) {                                if(logger.isDebugEnabled()) {                                    logger.debug("acknowledgement timer: exceeded " +                                        (aec + 1) + " time(s).");                                }                                aec++;                                a_timer.restart();                                setState(STATE_RESULT_RESP_WAIT);                            } else if (aec == AEC_MAX) {                                //abort if acknowledgement counter exceeds the maximum                                logger.error("acknowledgement timer: exceeded " +                                    (aec + 1) + " time(s) --> cancel");                                CWTPAbort send = new CWTPAbort(sendTID);                                send.setAbortReason(CWTPAbort.ABORT_REASON_NORESPONSE);                                wtpSocket.send(send);                                close(CWTPAbort.ABORT_REASON_NORESPONSE);                                aec = 0;                                setState(STATE_NULL);                            }                        }                    }                });        // see declaration of r_timer above        r_timer = new javax.swing.Timer(r,                new ActionListener() {                    public void actionPerformed(ActionEvent e) {                        r_timer.stop();                        if (state == STATE_RESULT_WAIT) {                            // check retransmission counter                            if (rcr < RCR_MAX) {                                /** @todo Ack(TIDok) already sent? Page 53 */                                if(logger.isDebugEnabled()) {                                    logger.debug("retransmission timer: exceeded " +                                    (rcr + 1) + " time(s) --> re-send");                                }                                rcr++;                                r_timer.restart();                                // re-send recent Invoke                                sentPDU.setRID(true);                                wtpSocket.send(sentPDU);                                setState(STATE_RESULT_WAIT);                            } else if (rcr == RCR_MAX) {                                logger.error("retransmission timer: exceeded " +                                    (rcr + 1) + " time(s) --> cancel");                                // abort                                close(CWTPAbort.ABORT_REASON_UNKNOWN);                                upperLayer.tr_abort(CWTPAbort.ABORT_REASON_UNKNOWN);                                rcr = 0;                                setState(STATE_NULL);                            }                        }                    }                });        // see declaration of w_timer above        w_timer = new javax.swing.Timer(w,                new ActionListener() {                    public void actionPerformed(ActionEvent e) {                        w_timer.stop();                        if (state == STATE_WAIT_TIMEOUT) {                            logger.debug("wait timeout");                            setState(STATE_NULL);                            close((short) 0x00);                        }                    }                });        // see declaration of w_timer above        s_timer = new javax.swing.Timer(s,                new ActionListener() {                    public void actionPerformed(ActionEvent e) {                        s_timer.stop();                        if (segment_sended > segment_sended_max) {                            if(logger.isDebugEnabled()) {                                logger.debug("wait_ack timeout (" + segment_sended +                                    "), abort.");                            }                            segment_sended = 1;                            setState(STATE_NULL);                            close((short) 0x00);                        } else {                            if (state == STATE_WAIT_ACK) {                                if(logger.isDebugEnabled()) {                                    logger.debug("wait_ack timeout (" +                                        segment_sended + "), re-sending segment.");                                }                                segment.setRID(true);                                wtpSocket.send(segment);                                segment_sended++;                                s_timer.restart();                            }                        }                    }                });    }    //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX    //XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX    /**     * Invoked by the run()-Method of the Management-Entity CWTPManagement.     * Processes given protocol data units     * according to state machine described in section 9.5     * <b>Notice:</b> Only WTP Initiator is implemented!     *     * @param pdu the pdu to be processed in the state machine     */    public synchronized void process(CWTPPDU pdu) throws EWTPAbortedException {        if (aborted) {            throw new EWTPAbortedException(abortCode);        }        if (logger.isDebugEnabled()) {            logger.debug("process(CWTPPDU pdu)  " + sendTID + ": " + CWTPPDU.types[pdu.getPDUType()] +                " in " + states[state] + " class " + classType + " holdOn " +                holdOn);        }        switch (state) {        ///////////////////// NULL //////////////////////////////////////////////        case 0x00:            // because only initiator is implemented,            // we do not need to react on pdu-events in NULL state            break;        ///////////////////// RESULT WAIT ///////////////////////////////////////        case 0x01:            // RcvAck in RESULT WAIT            if (pdu.getPDUType() == CWTPPDU.PDU_TYPE_ACK) {                if (((CWTPAck) pdu).getTve_tok() &&                        ((classType == 1) || (classType == 2)) &&                        (rcr < RCR_MAX)) {                    CWTPAck send = new CWTPAck(((CWTPAck) pdu).getTID() &                            0x7fff);                    send.setTve_tok(true);                    wtpSocket.send(send);                    rcr++;                    r_timer.restart();                    setState(STATE_RESULT_WAIT);                } else if (((CWTPAck) pdu).getTve_tok() &&                        ((classType == 1) || (classType == 2))) {                    setState(STATE_RESULT_WAIT);                } else if ((classType == 2) && !holdOn) {                    r_timer.stop();                    upperLayer.tr_process(new CWTPEvent(pdu.getPayload(),                            CWTPEvent.TR_INVOKE_CNF));                    this.holdOn = true;                    setState(CWTPInitiator.STATE_RESULT_WAIT);                } else if ((classType == 2) && holdOn) {                    setState(STATE_RESULT_WAIT);                } else if (classType == 1) {                    r_timer.stop();                    upperLayer.tr_process(new CWTPEvent(pdu.getPayload(),                            CWTPEvent.TR_INVOKE_CNF));                    setState(STATE_NULL);                }            }            // RcvAbort in RESULT WAIT            else if (pdu.getPDUType() == CWTPPDU.PDU_TYPE_ABORT) {                short abortReason = ((CWTPAbort) pdu).getAbortReason();                close(abortReason);                upperLayer.tr_abort(abortReason);                setState(STATE_NULL);            }            // RcvResult in RESULT WAIT            else if (pdu.getPDUType() == CWTPPDU.PDU_TYPE_RESULT && classType == 2) {              CWTPResult res = (CWTPResult) pdu;              byte nextState=STATE_RESULT_RESP_WAIT;              // Stop timer              r_timer.stop();              // Check for segmentation indication              if( !res.getTTR() )              {                logger.debug("Not last packet");                segend = 0; seglast = 0;                segdata = new  ByteArrayOutputStream(64*1024); // 64kbyte segs                segTID = pdu.getTID();                try {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线视频不卡| 欧美色大人视频| 91蜜桃传媒精品久久久一区二区| 成人免费看黄yyy456| 色综合天天性综合| 91精品欧美福利在线观看| 26uuu国产在线精品一区二区| 国产精品美女久久久久av爽李琼| 亚洲综合久久久久| 美腿丝袜亚洲综合| 成人激情av网| 欧美老年两性高潮| 欧美精品一区二区三区高清aⅴ| 国产精品萝li| 日本 国产 欧美色综合| 丰满放荡岳乱妇91ww| 欧美日韩一区在线| 中文字幕第一区综合| 日韩电影在线观看电影| 99久久精品国产一区二区三区| 欧美伦理电影网| 中文字幕色av一区二区三区| 一区二区三区在线免费| 韩国女主播成人在线| 色婷婷国产精品综合在线观看| 欧美日韩三级一区二区| 国产精品美女久久久久aⅴ| 日本最新不卡在线| 国产一区二三区好的| 欧美喷潮久久久xxxxx| 国产精品情趣视频| 久久99精品视频| 欧美日韩一区国产| 亚洲精品国产无套在线观| 国产ts人妖一区二区| 这里只有精品视频在线观看| 亚洲欧美一区二区久久| 日韩极品在线观看| 精品视频色一区| 国产肉丝袜一区二区| 激情综合亚洲精品| 日韩一区二区视频在线观看| 亚洲午夜在线电影| 国产电影一区二区三区| 日韩欧美国产成人一区二区| 日本va欧美va精品发布| 91网站在线播放| 亚洲欧美国产77777| 国产福利一区二区三区视频| 欧美一区二区三区视频| 亚洲丰满少妇videoshd| 91香蕉国产在线观看软件| 国产精品久久久久久久久免费桃花 | 欧洲视频一区二区| 亚洲天堂免费看| 欧美日韩高清一区二区三区| 日韩福利电影在线观看| 欧美成人一区二区三区片免费 | 国产午夜精品一区二区三区视频| 国产精品一二三区在线| 亚洲欧美国产高清| 欧美日本一道本在线视频| 精品一区二区免费| 日韩码欧中文字| 在线播放91灌醉迷j高跟美女| 极品瑜伽女神91| 亚洲伦理在线精品| 在线综合视频播放| 成人免费毛片a| 污片在线观看一区二区| 久久人人97超碰com| 色婷婷久久一区二区三区麻豆| 奇米777欧美一区二区| 中文欧美字幕免费| 欧美精品日日鲁夜夜添| 国产一区二区免费看| 一区二区三区.www| 久久婷婷国产综合国色天香| 91麻豆国产自产在线观看| 免费看黄色91| 亚洲欧美日韩一区| 精品国产伦一区二区三区观看体验| 91在线国产观看| 国产一区在线不卡| 婷婷六月综合网| 成人免费在线播放视频| 精品久久久久久最新网址| 91在线播放网址| 国产一区亚洲一区| 日韩精品福利网| 亚洲综合一二区| 国产精品久久久久三级| 精品国产a毛片| 4438x成人网最大色成网站| 色域天天综合网| 成人午夜免费电影| 国产一区二区毛片| 蜜桃精品视频在线| 日韩高清在线一区| 亚洲国产精品久久不卡毛片| 亚洲视频在线一区观看| 国产午夜精品久久| 精品国产一区二区三区忘忧草 | 国产一二精品视频| 美女网站色91| 麻豆精品一区二区综合av| 一区二区三区免费看视频| 亚洲视频综合在线| 亚洲视频免费观看| 亚洲欧洲制服丝袜| 一区二区国产盗摄色噜噜| 亚洲色图制服丝袜| 亚洲女同ⅹxx女同tv| 亚洲女人****多毛耸耸8| 亚洲另类在线视频| 一区二区三区四区亚洲| 亚洲九九爱视频| 一区二区三区中文字幕电影| 亚洲伦理在线精品| 亚洲一区av在线| 亚洲一区二区三区免费视频| 一区二区欧美视频| 亚洲成av人片www| 日日欢夜夜爽一区| 美女视频免费一区| 粉嫩av一区二区三区粉嫩 | 日本伊人精品一区二区三区观看方式| 一区二区三区精品久久久| 亚洲一二三区不卡| 青草av.久久免费一区| 国产精品综合一区二区| 国产成人av电影在线| 色哟哟日韩精品| 欧美精品免费视频| 久久美女艺术照精彩视频福利播放| 日本一区二区三区电影| 亚洲美女免费视频| 日韩专区中文字幕一区二区| 精品一区二区三区在线播放| 风间由美一区二区av101| 欧洲精品视频在线观看| 日韩欧美中文字幕制服| 国产日产欧美一区二区视频| 一区二区三区在线不卡| 久久精品久久综合| 99re亚洲国产精品| 56国语精品自产拍在线观看| 国产亚洲一本大道中文在线| 日韩理论片在线| 热久久久久久久| 91免费国产在线观看| 日韩限制级电影在线观看| 亚洲国产成人一区二区三区| 亚洲福利一二三区| 国产69精品一区二区亚洲孕妇| 在线视频国内一区二区| 亚洲精品一区二区三区在线观看| 中文字幕亚洲区| 狂野欧美性猛交blacked| 99精品欧美一区二区三区小说 | 一区二区中文字幕在线| 亚洲大型综合色站| 丁香另类激情小说| 日韩女优视频免费观看| 亚洲激情自拍视频| 国产91清纯白嫩初高中在线观看 | 色综合色综合色综合色综合色综合| 日韩一区二区精品| 一区二区三区毛片| 懂色中文一区二区在线播放| 日韩欧美国产综合| 亚洲国产中文字幕| 成a人片国产精品| 精品少妇一区二区三区视频免付费| 悠悠色在线精品| 成人亚洲一区二区一| 欧美大片拔萝卜| 午夜久久久久久久久久一区二区| 99久久综合精品| 久久久精品国产99久久精品芒果| 日韩不卡一二三区| 欧美三级日韩三级| 亚洲欧美日韩久久精品| 成人av一区二区三区| 欧美激情一区二区三区| 国产自产视频一区二区三区| 日韩欧美一二区| 美女在线观看视频一区二区| 欧美日韩专区在线| 亚洲电影第三页| 欧美中文字幕一二三区视频| 一区二区三区欧美激情| 色哟哟一区二区三区| 亚洲免费在线看| 91精品福利在线| 尤物视频一区二区| 欧美日韩一区二区三区四区五区| 亚洲人成精品久久久久| 一本一道综合狠狠老| 一区二区三区高清在线|