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

📄 cmppthread.java~18~

📁 移动CMPP3.0协议短信网关连接程序
💻 JAVA~18~
字号:
import java.util.*;import com.huawei.smproxy.*;import com.huawei.insa2.comm.cmpp.message.*;import com.huawei.insa2.comm.cmpp30.message.*;import com.huawei.insa2.util.*;public  class CmppThread extends Thread {       private boolean shutdown;       private static  Args args;       private static MySMProxy30 myProxy = null;       public static CMPP30DeliverMessage1 UpMessage1;       public static CMPP30DeliverMessage1 DownMessage1;       static byte[] msg_Id = null;//     static Date   Time;       static int query_Type = 0;       static String query_Code = " ";       static String reserve = " ";       static int pk_Total = 1;       static int pk_Number = 1;       static int registered_Delivery = 0;       static int msg_Level = 0;       static String service_Id = "11"; //业务标识       static int fee_UserType = 0;       static String fee_Terminal_Id = " "; //无意义怎么填写       static int fee_Terminal_Type = 0;       static int tp_Pid = 0;       static int tp_Udhi = 0;       static int msg_Fmt = 15;       static String msg_Src = "901234"; //sp_id       static String fee_Type = "01";       static String fee_Code = "150";       static Date valid_Time;       static Date at_Time;       static String src_Terminal_Id = "011234"; //sp的服务代码       static String[] dest_Terminal_Id = {"13666666688"};       static int dest_Terminal_Type = 0;       static byte[] msg_Content = {'1', '2'};       static String LinkID = "12"; //一定要写,否则会报错        public CmppThread() {            try {                args=new Cfg("app.xml", false).getArgs("CMPPConnect");                System.out.println("CmppThread 启动");                myProxy = new MySMProxy30(args);//*******************************************************************************            } catch (java.io.IOException e) {                e.printStackTrace();                System.out.println(e.toString() );                throw new IllegalStateException("初始化发送线程出错");            }        }        public int CmppSend(byte[]con,String num){            try{                dest_Terminal_Id[0]=num;                CMPP30SubmitMessage submitMsg = new CMPP30SubmitMessage(                        pk_Total,                        pk_Number, registered_Delivery, msg_Level, service_Id,                        fee_UserType, fee_Terminal_Id, fee_Terminal_Type,                        tp_Pid,                        tp_Udhi, msg_Fmt, msg_Src, fee_Type, fee_Code,                        valid_Time,                        at_Time, src_Terminal_Id,dest_Terminal_Id,                        dest_Terminal_Type,con, LinkID);                myProxy.send(submitMsg);            }catch(java.io.IOException e)            {               e.printStackTrace();               System.out.println(e.toString() );               return 0;//             throw new IllegalStateException("发送失败,发送线程终止");            }catch(Exception e)            {               System.out.println(e);               return 0;            }                return 1;        }        public CMPP30DeliverMessage1 CmppReceive(){                if(myProxy.num>0)                {                    System.out.println(myProxy.num);                    myProxy.num--;                    return myProxy.UpMessage[myProxy.num];                }               else                   return null;        }        public void run() {//本函数什么作用,用来发送短信的?//            try//            {                System.out.println("run函数启动。。。。。。。。。。。。");//                UpMessage1=myProxy.UpMessage;//                UpMessage1=new CMPP30DeliverMessage1();/*                for(int i=0;i<10;i++)                {                    UpMessage1=myProxy.UpMessage[i];                    serverOutputStream.writeObject(UpMessage1);                    if(myProxy.UpMessage[i].mark==0)                        break;                }*/            }//*****************************************************************************************/*                while (!shutdown && !isInterrupted())                {                    if(pipe.isBound()&&myProxy.upMessage!=null)                    {                    }                        Thread.sleep(4000);                }            }catch(java.io.IOException e) {                e.printStackTrace();                System.out.println(e.toString() );                throw new IllegalStateException("发送失败,发送线程终止");            } catch(InterruptedException e) {                Thread.currentThread().interrupt();                e.printStackTrace();            }*///*****************************************************************************************//           myProxy.close();}

⌨️ 快捷键说明

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