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

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

?? receiverbase.java

?? Short Message Peer to Peer
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
 * Copyright (c) 1996-2001
 * Logica Mobile Networks Limited
 * All rights reserved.
 *
 * This software is distributed under Logica Open Source License Version 1.0
 * ("Licence Agreement"). You shall use it and distribute only in accordance
 * with the terms of the License Agreement.
 *
 */
package org.smpp;

import java.io.IOException;

import org.smpp.pdu.PDU;
import org.smpp.pdu.HeaderIncompleteException;
import org.smpp.pdu.MessageIncompleteException;
import org.smpp.pdu.PDUException;
import org.smpp.pdu.UnknownCommandIdException;
import org.smpp.util.ByteBuffer;
import org.smpp.util.ProcessingThread;
import org.smpp.util.Unprocessed;
import org.smpp.util.NotEnoughDataInByteBufferException;

/**
 * Abstract base class for classes which can receive PDUs from connection.
 * The receiving of PDUs can be be performed on background within a separate
 * thread using the <code>ProcessingThread</code> class.
 * 
 * @author Logica Mobile Networks SMPP Open Source Team
 * @version $Revision: 1.4 $
 * @see Receiver
 * @see OutbindReceiver
 * @see Connection
 * @see Transmitter
 * @see Session
 */
public abstract class ReceiverBase extends ProcessingThread {

	/**
	 * Timeout for receiving the rest of PDU from the connection.
	 * If the rest of PDU isn't receive in time, <code>TimeoutException</code>
	 * is thrown.
	 *
	 * @see TimeoutException
	 */
	private long receiveTimeout = Data.RECEIVER_TIMEOUT;


	private byte messageIncompleteRetryCount = 0;


	/**
	 * Method repeatedly called from <code>process</code> method.
	 * It's expected that derived classes implement atomic receive of
	 * one PDU in this method using ReceiverBase's
	 * <code>tryReceivePDUWithTimeout</code> and 
	 * <code>receivePDUFromConnection</code> methods.
	 *
	 * @see #tryReceivePDUWithTimeout(Connection,PDU,long)
	 * @see ProcessingThread#process()
	 * @see ProcessingThread#run()
	 */
	protected abstract void receiveAsync();

	/**
	 * This method should try to receive one PDU from the connection.
	 * It is called in cycle from <code>tryReceivePDUWithTimeout</code> until
	 * timeout expires. The method should check if the actualy received
	 * PDU is equal to the <code>expectedPDU</code>.
	 *
	 * @param connection  the connection from which the PDU should be received
	 * @param expectedPDU the command id and sequence id of the received PDU
	 *                    should be equal to those of expectedPDU
	 * @return the received PDU if any or null if none received
	 *
	 * @exception IOException exception during communication
	 * @exception PDUException incorrect format of PDU
	 * @exception TimeoutException rest of data not received for too long time
	 * @exception UnknownCommandIdException PDU with unknown id was received
	 * @see #tryReceivePDUWithTimeout(Connection,PDU,long)
	 * @see #receiveAsync()
	 * @see #run()
	 * @see PDU#equals(Object)
	 */
	protected abstract PDU tryReceivePDU(Connection connection, PDU expectedPDU)
		throws UnknownCommandIdException, TimeoutException, PDUException, IOException;

	/**
	 * This is an implementation of <code>ProcessingThread</code>'s 
	 * <code>process</code> method, which is method called in loop from
	 * the <code>run</code> method.<br>
	 * This simply calls <code>receiveAsync</code>.
	 */
	public void process() {
		receiveAsync();
	}

	/**
	 * Calls <code>tryReceivePDUWithTimeout(Connection,PDU,long)</code> with
	 * timeout set by <code>setReceiveTimeout</code>.
	 *
	 * @param connection  the connection from which the PDU should be received
	 * @param expectedPDU the command id and sequence id of the received PDU
	 *                    should be equal to those of expectedPDU
	 * @return the received PDU if any or null if none received
	 *
	 * @exception IOException exception during communication
	 * @exception PDUException incorrect format of PDU
	 * @exception TimeoutException rest of data not received for too long time
	 * @exception UnknownCommandIdException PDU with unknown id was received
	 * @see #tryReceivePDUWithTimeout(Connection,PDU,long)
	 */
	final protected PDU tryReceivePDUWithTimeout(Connection connection, PDU expectedPDU)
		throws UnknownCommandIdException, TimeoutException, PDUException, IOException {
		return tryReceivePDUWithTimeout(connection, expectedPDU, getReceiveTimeout());
	}

	/**
	 * For specified time tries to receive a PDU from given connection by 
	 * calling method <code>tryReceivePDU</code>.
	 * The method <code>tryReceivePDU</code> must be implemented in the derived
	 * class.
	 * <p>
	 * The timeout can be either value > 0, then it means for
	 * how many milliseconds will be repeatedly tried to receive a PDU.
	 * If the timeout is = 0 then there is only one attempt to receive a PDU.
	 * If the timeout is equal to Data.RECEIVE_BLOCKING, then the this method
	 * tries receive a PDU until it is received.
	 *
	 * @param connection  the connection from which the PDU should be received
	 * @param expectedPDU the command id and sequence id of the received PDU
	 *                    should be equal to those of expectedPDU
	 * @param timeout     the timeout indication
	 * @return the received PDU if any or null if none received
	 * 
	 * @exception IOException exception during communication
	 * @exception PDUException incorrect format of PDU
	 * @exception TimeoutException rest of data not received for too long time
	 * @exception UnknownCommandIdException PDU with unknown id was received
	 * @see #tryReceivePDU(Connection,PDU)
	 * @see PDU#equals(Object)
	 */
	final protected PDU tryReceivePDUWithTimeout(Connection connection, PDU expectedPDU, long timeout)
		throws UnknownCommandIdException, TimeoutException, PDUException, IOException {
		debug.write(DRXTX, "receivePDU: Going to receive response.");
		long startTime = Data.getCurrentTime();
		PDU pdu = null;
		if (timeout == 0) {
			// with no timeout try just once
			pdu = tryReceivePDU(connection, expectedPDU);
		} else {
			// with timeout keep trying until get some or timeout expires
			while ((pdu == null) && canContinueReceiving(startTime, timeout)) {
				pdu = tryReceivePDU(connection, expectedPDU);
			}
		}
		if (pdu != null) {
			debug.write(DRXTX, "Got pdu " + pdu.debugString());
		}
		return pdu;
	}

	/**
	 * Elementary method receiving data from connection, trying to create
	 * PDU from them and buffering data in case the PDU
	 * isn't still complete. It has timeout checking for incomplete
	 * messages: if the message isn't received completly for certain time
	 * and no new data are received for this time, then exception is thrown
	 * as this could indicate communication problem.
	 *
	 * @param connection the connection to receive the data from
	 * @return either PDU, if complete received or null
	 *
	 * @exception IOException exception during communication
	 * @exception PDUException incorrect format of PDU
	 * @throws TimeoutException rest of data not received for too long time
	 * @throws UnknownCommandIdException PDU with unknown id was received
	 * @see Connection
	 * @see Unprocessed
	 */
	final protected PDU receivePDUFromConnection(Connection connection, Unprocessed unprocessed)
		throws UnknownCommandIdException, TimeoutException, PDUException, IOException {
		debug.write(DRXTXD2, "ReceiverBase.receivePDUFromConnection start");
		PDU pdu = null;
		ByteBuffer buffer;
		ByteBuffer unprocBuffer;
		
		try {
			// first check if there is something left from the last time
			if (unprocessed.getHasUnprocessed()) {
				unprocBuffer = unprocessed.getUnprocessed();
				debug.write(DRXTX, "have unprocessed " + unprocBuffer.length() + " bytes from previous try");
				pdu = tryGetUnprocessedPDU(unprocessed);
			}
			if (pdu == null) { // only if we didn't manage to get pdu from unproc
				buffer = connection.receive();
				unprocBuffer = unprocessed.getUnprocessed();
				// if received something now or have something from the last receive
				if (buffer.length() != 0) {
					unprocBuffer.appendBuffer(buffer);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美久久一区二区| 中文字幕在线免费不卡| 欧美激情在线免费观看| 亚洲欧美另类小说| 精品一区二区三区免费毛片爱| 国产91精品免费| 欧美高清精品3d| 国产精品国产三级国产a| 亚洲成人动漫一区| av中文字幕不卡| www亚洲一区| 午夜精品久久久久影视| av网站免费线看精品| 91精品国产91热久久久做人人 | 国产女主播视频一区二区| 午夜视频一区二区| 99亚偷拍自图区亚洲| 久久久久久久久久久99999| 亚洲高清在线视频| 成人avav影音| 国产欧美一区二区精品忘忧草| 日韩激情一区二区| 91麻豆免费观看| 国产精品福利在线播放| 国产精品亚洲视频| 日韩三级.com| 日韩在线卡一卡二| 欧美午夜免费电影| 亚洲激情成人在线| 成人av电影在线| 国产午夜精品一区二区三区视频| 日本一不卡视频| 777午夜精品视频在线播放| 亚洲精品久久7777| 97久久超碰国产精品电影| 欧美国产精品一区二区三区| 激情综合色丁香一区二区| 欧美一区二区三区思思人| 日韩成人精品在线| 91精品国产美女浴室洗澡无遮挡| 亚洲国产精品久久一线不卡| 欧美亚洲综合另类| 亚洲国产欧美在线人成| 欧美日韩一级视频| 亚洲高清免费视频| 911精品产国品一二三产区| 视频一区国产视频| 欧美一区二区视频在线观看2020 | 国产精品成人免费精品自在线观看| 国产在线观看一区二区| 久久婷婷色综合| 国产91精品一区二区麻豆亚洲| 国产视频一区二区在线| 成人av第一页| 亚洲一区二区三区国产| 7799精品视频| 国产精品资源网| 欧美韩日一区二区三区| 不卡的看片网站| 亚洲欧美成aⅴ人在线观看| 欧美日韩在线精品一区二区三区激情| 亚洲一区免费视频| 日韩一区二区三区视频在线观看| 久久99精品一区二区三区 | 欧美日韩一区二区三区高清| 日韩1区2区3区| 久久一区二区三区四区| www.成人网.com| 亚洲国产另类av| 久久中文字幕电影| 色诱亚洲精品久久久久久| 午夜精品久久久久久久久 | 欧美日韩成人一区二区| 九九久久精品视频| 亚洲激情在线激情| 日韩精品一区二区三区视频在线观看| 风间由美一区二区三区在线观看 | av中文一区二区三区| 亚洲va天堂va国产va久| 国产日韩欧美精品电影三级在线| 97精品电影院| 九九国产精品视频| 亚洲一二三区在线观看| 久久久精品一品道一区| 91精品办公室少妇高潮对白| 精品在线视频一区| 夜夜爽夜夜爽精品视频| 国产亚洲一区二区三区在线观看| 91国产精品成人| 国产米奇在线777精品观看| 亚洲自拍偷拍网站| 中文字幕免费一区| 欧美成人女星排名| 欧美老肥妇做.爰bbww| 波多野结衣视频一区| 精一区二区三区| 日韩福利视频导航| 亚洲激情第一区| 国产精品免费av| 久久在线观看免费| 日韩一区二区三区在线视频| 精品视频在线视频| 色狠狠一区二区三区香蕉| 懂色一区二区三区免费观看| 韩国欧美国产一区| 久久精品理论片| 天堂一区二区在线| 亚洲一区二区三区四区中文字幕| 国产精品人成在线观看免费| 日韩视频一区二区三区在线播放| 色久优优欧美色久优优| 成人欧美一区二区三区1314| 久久久国产午夜精品| 欧美大片一区二区| 欧美三级视频在线观看| 在线观看视频一区| 不卡免费追剧大全电视剧网站| 国产真实乱对白精彩久久| 亚洲一区二区欧美日韩| 最新日韩av在线| 国产日产精品一区| 欧美本精品男人aⅴ天堂| 国产精品影视在线| 国产一区二区视频在线| 日韩国产一区二| 亚洲在线视频免费观看| 最新日韩av在线| 久久久久久黄色| 欧美日韩精品一区二区三区四区| 国产精品综合网| 久久99热狠狠色一区二区| 日韩不卡免费视频| 亚洲国产日日夜夜| 午夜精品123| 亚洲国产精品人人做人人爽| 亚洲影院理伦片| 亚洲自拍都市欧美小说| 日本女优在线视频一区二区| 日韩黄色小视频| 日韩av一区二区三区| 午夜精品久久久久久久蜜桃app| 亚洲免费av高清| 婷婷综合五月天| 日韩国产一二三区| 极品美女销魂一区二区三区免费| 免费美女久久99| 久久精品久久综合| 国产大陆精品国产| av男人天堂一区| 色94色欧美sute亚洲线路一久| 99国产精品国产精品久久| 国产成人精品网址| 在线观看一区二区精品视频| 欧美私模裸体表演在线观看| 欧美区在线观看| 欧美v日韩v国产v| 亚洲成人自拍一区| 日本欧美在线观看| 精品一区二区三区影院在线午夜| 国产精品一品二品| 国产精品一区免费视频| 日本久久电影网| 9191久久久久久久久久久| 精品日韩在线一区| 中文字幕亚洲视频| 理论电影国产精品| 暴力调教一区二区三区| 91福利在线看| 日韩精品一区在线| 国产亚洲女人久久久久毛片| 婷婷国产在线综合| 九九视频精品免费| 色综合久久久久久久久| 欧美精选一区二区| 中文字幕亚洲在| 日韩 欧美一区二区三区| 粉嫩嫩av羞羞动漫久久久 | 亚洲欧美另类综合偷拍| 韩国毛片一区二区三区| 99v久久综合狠狠综合久久| 欧美日韩国产成人在线91| 久久免费精品国产久精品久久久久| 亚洲不卡一区二区三区| 大胆亚洲人体视频| 欧美丰满少妇xxxxx高潮对白| 国产蜜臀97一区二区三区| 精品久久久久99| 三级成人在线视频| 9久草视频在线视频精品| 欧美成人高清电影在线| 亚洲女同一区二区| 91天堂素人约啪| 久久亚洲免费视频| 国产91丝袜在线18| 制服丝袜在线91| 偷窥少妇高潮呻吟av久久免费| 99麻豆久久久国产精品免费优播| 欧美一区永久视频免费观看| 亚洲综合色视频| 欧美日韩在线播放|