⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendmanager.java~82~

📁 短信网关发送接受平台。
💻 JAVA~82~
字号:
import Utilities.*;
import java.io.*;
import java.net.*;

/**
 * <p>Title: InHand SMS platform XMLRouter</p>
 * <p>Description: InHand 短信服务平台服务路由器</p>
 * <p>Copyright: Copyright (c) 2002</p>
 * <p>Company: 北京映翰通网络技术有限公司</p>
 * @author 韩传俊 shock2000@21cn.com
 * @version 1.0
 */

public class SendManager extends Engine {
        public BufferedOutputStream out;

        public SendManager(OutputStream out) {
                super("SendManager");
                this.out=new BufferedOutputStream(out);
        }

        public void run(){
                String str="";
               // while (Config.send_queue.isEmpty()){
                 //                       this.out.println("<get_gateway_status></get_gateway_status>");
                 //                       this.sleep(5000);
               // }
               String status="<get_gateway_status id=\"0\" type=\"router\"></get_gateway_status>\r\n";
               byte[] bytes=status.getBytes();
               //
               try{
                        this.out.write(status.getBytes());
                }catch(Exception e){
                        e.printStackTrace();
                        shutdown();
                }
                while(isRunning()){
                        try{

                                //this.out.write(status.getBytes());
                                if(!Config.send_queue.isEmpty()){
                                        str=(String)Config.send_queue.pop();
                                        str=str+"\r\n";
                                        this.out.write(str.getBytes());
                                        if (str.startsWith("<cmpp_su"))
                                                Config.incMt();
                                        Config.incOut();
                                        //Config.handle_recoder_number++;
                                        //System.out.println("===== Send: "+Utility.getCutString(str));
                                        Config.log.log("server","Send",str);
                                }else{
                                        this.out.write(bytes);
                                        //System.out.println("===== Sending: <get_gateway_status></get_gateway_status>");
                                        //Config.log.log("==no out put=== Sending: <get_gateway_status></get_gateway_status>");
                                        sleep(1000);
                                }
                                this.out.flush();

                        }catch(Exception e){
                                this.shutdown();
                                Config.log.log(e,"while the thread: "+this.toString()+" is writing data from socket!" );
                                System.out.println("while the thread: "+this.toString()+" is writing data from socket!");

                        }
                }
                shutdown();
        }

        public void shutdown(){
                super.shutdown();
                try{
                        this.out.close();
                }catch(Exception e){}
        }

        public static void main(String[] args) {
                //SendManager sendManager1 = new SendManager();
        }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -