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

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

?? smscsessionimpl.java

?? Short Message Peer to Peer
?? JAVA
字號:
/*
 * 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.smscsim;

import java.io.IOException;

import org.smpp.Connection;
import org.smpp.Receiver;
import org.smpp.Transmitter;
import org.smpp.SmppObject;
import org.smpp.Data;
import org.smpp.pdu.*;

/**
 * This class represent one client connection to the server starting
 * by accepting the connection, authenticating of the client,
 * communication and finished by unbinding.
 * The <code>SMSCSession</code> object is generated by <code>SMSCListener</code>
 * which also sets the session's PDU processor. Session is run in separate
 * thread; it reads PDUs from the connection and calls PDU processor's
 * client methods to process the received PDUs. PDU processor on turn can
 * use the session to submit PDUs to the client.
 * For receiving and sending of PDUs the session uses instances of
 * <code>Receiver</code> and <code>Transmitter</code>.
 *
 * @author Logica Mobile Networks SMPP Open Source Team
 * @version $Revision: 1.2 $
 * @see SMSCListener
 * @see PDUProcessor
 * @see Connection
 * @see Receiver
 * @see Transmitter
 */
public class SMSCSessionImpl extends SmppObject implements SMSCSession {
	private Receiver receiver;
	private Transmitter transmitter;
	private PDUProcessor pduProcessor;
	private Connection connection;
	private long receiveTimeout = Data.RECEIVER_TIMEOUT;
	private boolean keepReceiving = true;
	private boolean isReceiving = false;
	private int timeoutCntr = 0;

	/**
	 * Initialises the session with the connection the session
	 * should communicate over.
	 * @param connection the connection object for communication with client
	 */
	public SMSCSessionImpl(Connection connection) {
		this.connection = connection;
		transmitter = new Transmitter(connection);
		receiver = new Receiver(transmitter, connection);
	}

	/**
	 * Signals the session's thread that it should stop.
	 * Doesn't wait for the thread to be completly finished.
	 * Note that it can take some time before the thread is completly
	 * stopped.
	 * @see #run()
	 */
	public void stop() {
		debug.write("SMSCSession stopping");
		keepReceiving = false;
	}

	/**
	 * Implements the logic of receiving of the PDUs from client and passing
	 * them to PDU processor. First starts receiver, then in cycle
	 * receives PDUs and passes them to the proper PDU processor's
	 * methods. After the function <code>stop</code> is called (externally)
	 * stops the receiver, exits the PDU processor and closes the connection,
	 * so no extry tidy-up routines are necessary.
	 * @see #stop()
	 * @see PDUProcessor#clientRequest(Request)
	 * @see PDUProcessor#clientResponse(Response)
	 */
	public void run() {
		PDU pdu = null;

		debug.enter(this, "SMSCSession run()");
		debug.write("SMSCSession starting receiver");
		receiver.start();
		isReceiving = true;
		try {
			while (keepReceiving) {
				try {
					debug.write("SMSCSession going to receive a PDU");
					pdu = receiver.receive(getReceiveTimeout());
				} catch (Exception e) {
					debug.write("SMSCSession caught exception receiving PDU " + e.getMessage());
				}

				if (pdu != null) {
					timeoutCntr = 0;
					if (pdu.isRequest()) {
						debug.write("SMSCSession got request " + pdu.debugString());
						pduProcessor.clientRequest((Request) pdu);
					} else if (pdu.isResponse()) {
						debug.write("SMSCSession got response " + pdu.debugString());
						pduProcessor.clientResponse((Response) pdu);
					} else {
						debug.write("SMSCSession not reqest nor response => not doing anything.");
					}
				} else {
					timeoutCntr++;
					if (timeoutCntr > 5) {
						debug.write("SMSCSession stoped due to inactivity");
						stop();
					}
				}
			}
		} finally {
			isReceiving = false;
		}
		debug.write("SMSCSession stopping receiver");
		receiver.stop();
		debug.write("SMSCSession exiting PDUProcessor");
		pduProcessor.exit();
		try {
			debug.write("SMSCSession closing connection");
			connection.close();
		} catch (IOException e) {
			event.write(e, "closing SMSCSession's connection.");
		}
		debug.write("SMSCSession exiting run()");
		debug.exit(this);
	}

	/**
	 * Sends a PDU to the client.
	 * @param pdu the PDU to send
	 */
	public void send(PDU pdu) throws IOException, PDUException {
		timeoutCntr = 0;
		debug.write("SMSCSession going to send pdu over transmitter");
		transmitter.send(pdu);
		debug.write("SMSCSession pdu sent over transmitter");
	}

	/**
	 * Sets new PDU processor.
	 * @param pduProcessor the new PDU processor
	 */
	public void setPDUProcessor(PDUProcessor pduProcessor) {
		this.pduProcessor = pduProcessor;
	}

	/**
	 * Sets the timeout for receiving the complete message.
	 * @param timeout the new timeout value
	 */
	public void setReceiveTimeout(long timeout) {
		receiveTimeout = timeout;
	}

	/**
	 * Returns the current setting of receiving timeout.
	 * @return the current timeout value
	 */
	public long getReceiveTimeout() {
		return receiveTimeout;
	}

	/**
	 * Returns the details about the account that is logged in to this session
	 * @return An object representing the account. It is casted to the correct type by the implementation
	 */
	public Object getAccount() {
		return null;
	}

	/**
	 * Set details about the account that is logged in to this session 
	 * @param account An object representing the account. It is casted to the correct type by the implementation
	 */
	public void setAccount(Object account) {
	}

	/**
	 * @return Returns the isReceiving.
	 */
	public boolean isReceiving() {
		return isReceiving;
	}

	/**
	 * @param isReceiving The isReceiving to set.
	 */
	public void setReceiving(boolean isReceiving) {
		this.isReceiving = isReceiving;
	}

}
/*
 * $Log: SMSCSessionImpl.java,v $
 * Revision 1.2  2006/03/09 16:24:15  sverkera
 * Removed compiler and javadoc warnings
 *
 * Revision 1.1  2003/09/30 09:17:49  sverkera
 * Created an interface for SMSCListener and SMSCSession and implementations of them  so that it is possible to provide other implementations of these classes.
 *
 * Revision 1.1  2003/07/23 00:28:39  sverkera
 * Imported
 *
 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚欧色一区w666天堂| 蜜乳av一区二区三区| kk眼镜猥琐国模调教系列一区二区| 日韩三级免费观看| 国产在线不卡一卡二卡三卡四卡| 2017欧美狠狠色| 成人99免费视频| 亚洲国产视频在线| 久久久美女毛片| 欧美中文一区二区三区| 日本人妖一区二区| 欧美国产日韩亚洲一区| 67194成人在线观看| 丁香婷婷综合色啪| 视频一区二区国产| 国产精品久久看| 日韩一区二区精品葵司在线| 成av人片一区二区| 国内精品久久久久影院一蜜桃| 亚洲人成网站色在线观看| 欧美一二三在线| 欧美日本一区二区| 97精品国产露脸对白| 国产成人精品亚洲777人妖| 亚洲自拍偷拍av| 亚洲欧美激情在线| 中文字幕欧美三区| 欧美国产成人在线| 国产精品成人一区二区艾草| 26uuuu精品一区二区| 精品成a人在线观看| 日韩欧美一级二级三级| 一本久道久久综合中文字幕| 国产一区不卡在线| 国产麻豆视频精品| 91视频一区二区| 日本韩国欧美一区二区三区| 91久久精品网| 在线播放中文字幕一区| 在线电影国产精品| 久久久蜜臀国产一区二区| 国产欧美一区二区三区在线老狼| 国产欧美综合在线观看第十页| 国产清纯白嫩初高生在线观看91| 国产欧美一区二区三区在线看蜜臀 | 亚洲一区二区三区四区在线| 一区二区三区在线免费观看| 亚洲国产精品人人做人人爽| 久久精品国产成人一区二区三区 | 日本伊人色综合网| 精品一区二区三区日韩| 色综合色狠狠综合色| 欧美一级欧美一级在线播放| 中文字幕免费一区| 五月激情六月综合| www.性欧美| 久久亚洲精精品中文字幕早川悠里| 久久精品男人天堂av| 丝袜美腿亚洲色图| 99精品视频一区| 久久嫩草精品久久久久| 亚洲狠狠爱一区二区三区| 波多野结衣中文一区| 国产亚洲欧洲一区高清在线观看| 一区二区三区日韩在线观看| 成人av在线资源| 久久久一区二区三区捆绑**| 免费在线一区观看| 精品捆绑美女sm三区| 午夜精品久久久久影视| 欧美日韩中文字幕一区二区| 亚洲精品免费一二三区| 色94色欧美sute亚洲线路二 | 91在线视频在线| 夜色激情一区二区| 欧美高清www午色夜在线视频| 婷婷开心激情综合| 欧美成人午夜电影| 成人中文字幕在线| 亚洲美女屁股眼交3| 欧美日韩精品电影| 国内精品视频666| 亚洲色图欧美激情| 欧美一区二区免费观在线| 国产激情一区二区三区| 亚洲卡通动漫在线| 久久精品亚洲一区二区三区浴池 | 蜜桃视频一区二区三区 | 亚洲欧洲av在线| 3d动漫精品啪啪一区二区竹菊| 国产精品一线二线三线精华| 国产精品水嫩水嫩| 26uuu国产日韩综合| 欧美日韩在线精品一区二区三区激情 | 91在线精品一区二区| 日本视频一区二区| 亚洲猫色日本管| 国产丝袜美腿一区二区三区| 欧美精品乱人伦久久久久久| yourporn久久国产精品| 奇米精品一区二区三区四区| 亚洲私人黄色宅男| 中文字幕高清不卡| 久久色在线观看| 久久久精品综合| 91精品国产福利| 欧美一区二区在线不卡| 欧美日韩三级一区| 欧美丰满一区二区免费视频| 日本韩国欧美在线| 欧美丝袜自拍制服另类| 欧美日韩久久久| 欧美人牲a欧美精品| 欧美性一二三区| 欧美日韩精品一区二区在线播放| 一本色道久久综合狠狠躁的推荐| 国产成人免费视频精品含羞草妖精| 玖玖九九国产精品| 经典三级在线一区| 国产成人h网站| 91丨九色porny丨蝌蚪| 欧美日韩一区二区三区四区五区| 欧美综合一区二区三区| 69久久夜色精品国产69蝌蚪网| 51午夜精品国产| 国产色一区二区| 亚洲免费观看高清完整版在线观看| 国产精品大尺度| 五月激情综合色| 国产91精品露脸国语对白| 色8久久人人97超碰香蕉987| 欧美日本韩国一区| 国产欧美一区二区精品秋霞影院| 亚洲综合色网站| 国产91精品在线观看| 欧美亚洲国产bt| 国产精品久线观看视频| 日本中文字幕不卡| 色悠悠亚洲一区二区| 日韩欧美国产综合一区| 亚洲国产欧美另类丝袜| 99久久伊人久久99| 欧美一级欧美三级在线观看| 日韩毛片在线免费观看| 国产一区二区三区精品欧美日韩一区二区三区 | 亚洲天堂av老司机| 国产激情一区二区三区桃花岛亚洲| 51午夜精品国产| 天堂va蜜桃一区二区三区漫画版| 成人av第一页| 亚洲欧美视频在线观看视频| 韩国中文字幕2020精品| 精品国产乱码91久久久久久网站| 亚洲动漫第一页| 91麻豆精品国产91| 午夜精品视频一区| 制服丝袜在线91| 久久国产精品露脸对白| 日韩欧美激情在线| 国产精品一级片在线观看| 久久久久久久免费视频了| 国产自产高清不卡| 国产日韩综合av| 91免费精品国自产拍在线不卡| 亚洲视频一二区| 欧美性视频一区二区三区| 丝袜美腿亚洲综合| 欧美精品一区二区三区高清aⅴ | 欧美国产精品久久| 99久久婷婷国产精品综合| 亚洲国产综合视频在线观看| 91精品国产综合久久精品性色 | 成人永久aaa| 亚洲成人激情社区| 欧美激情中文字幕一区二区| 欧美在线色视频| 风间由美一区二区三区在线观看| 中文字幕一区不卡| 久久久精品免费观看| 欧美日韩高清在线播放| 一区二区三区.www| 成人免费福利片| 日本三级亚洲精品| 国产校园另类小说区| 欧美色图天堂网| 国产高清视频一区| 亚洲成人精品一区| 国产精品私人影院| 精品国产一区二区精华| 在线视频国内自拍亚洲视频| 粉嫩av一区二区三区粉嫩| 日韩电影一区二区三区四区| 欧美激情中文字幕| 精品乱人伦一区二区三区| 欧美日产在线观看| 欧美性欧美巨大黑白大战| 成人听书哪个软件好| 韩国精品主播一区二区在线观看| 亚洲国产成人av好男人在线观看| 1024精品合集|