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

📄 appmain.cs

📁 这是一个很好的收发短信程序 需要都尽情享用
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
namespace Glenet.CMPP
{
    class AppMain
    {
        static void Main()
        {

            //发送消息
            string ip = "211.140.12.44";//;

            try
            {
                CMPP2Recive re = new CMPP2Recive("***", "***", "9***", ip, 7890, "10657306****");
                re.Connection();
                //接收消息处理
                re.CMPP_Deliver += new CMPP2Recive.CMPP_DeliverEventHandler(re_CMPP_Deliver);
                //启动线程
                re.Start();




            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            CMPP2Send send = new CMPP2Send("***", "***", "9***", ip, 7890, "10657306****");
            try
            {
                send.Connection();
                int i = 0;
                while (i < 1)
                {
                    UInt32 MessageID = send.Submit("test11111你好啊,朋友", "138****8959");

                    Console.WriteLine(MessageID);
                    i++;
                }
                send.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

          

            //re.Close();



            Console.ReadLine();
        }

        static void re_CMPP_Deliver(Glenet.CMPP.Messages.CMPP_DELIVER deliver)
        {
            string s = "";
            if (deliver.Registered_Delivery == 0) //普通短信
            {
                s = String.Format("普通短信: {0}\n{1}", deliver.Src_terminal_Id, deliver.Msg_Content);
                Console.WriteLine(s);
            }
            else
            //该模拟器不能自动生成状态报告再下发!请自行键入下面短信内容后,发送
            //状态报告短信: 00000001DELIVRD031213505003121350501391xxx11381391xxx11381391xx11380001
            {
                Glenet.CMPP.Messages.CMPP_Msg_Content x = new Glenet.CMPP.Messages.CMPP_Msg_Content(deliver.StatuByte);
                
                s = String.Format("状态报告: {0}\n{1}", x.Stat, x.Dest_terminal_Id);
                Console.WriteLine(s);
            }
        }

    }
}

⌨️ 快捷键说明

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