Exemplo n.º 1
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            CmppClientConfig config     = GetCmppClientConfig();
            CmppClient       cmppClient = new CmppClient(config, new CmppSmsHandler(loggerFactory), loggerFactory);

            Console.ReadLine();
            await cmppClient.DisposeAsync();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            List <CmppClient> clientList = new List <CmppClient>();

            for (int i = 0; i < 1; i++)
            {
                CmppClientConfig config = new CmppClientConfig()
                {
                    ConnNum       = 10,
                    ClientId      = "Test" + i,
                    Ip            = "127.0.0.1",
                    Password      = "******",
                    Port          = 7890,
                    SourceAddress = "614450",
                    UserName      = "******"
                };
                CmppClient cmppClient = new CmppClient(config, new SmsHandler());
                clientList.Add(cmppClient);
            }
            Console.ReadLine();

            Sms.Common.Sms sms = new Sms.Common.Sms()
            {
                ExObj        = "",
                ExtendedCode = "0",
                //Id = Guid.NewGuid().ToString(),
                Messgae = "【测试】123456",
                Mobile  = "13800138000"
            };
            clientList[0].SubmitSmsAsync(sms).ContinueWith(t => {
                if (t.Result)
                {
                    Console.WriteLine("===================>发送完成");
                }
                else
                {
                    Console.WriteLine("===================>发送失败");
                }
            });
            Console.ReadLine();

            ClientClose(clientList).ContinueWith(x =>
            {
                logger.LogInformation("=====================main>ClientClose task complete");
            });
            Console.ReadLine();
        }