示例#1
0
        public CmppSmsServer(SmsServerConfigurations configs) : base(configs)
        {
            this.MessageFactory = new CmppMessageFactory();
            _serviceId          = configs.ServiceID;

            _passwords = new Dictionary <string, string>();

            _passwords[configs.UserName] = configs.Password;
        }
示例#2
0
        public HyperCmppSmsServer(SmsServerConfigurations configs, bool isSimulated = false) : base(configs)
        {
            this.SubmitQueue = new SmsBufferedQueue <CmppSmsServerSubmitContext>("SUBMIT BUFFER");
            this.SubmitQueue.BufferCapacity = 500;
            this.SubmitQueue.SwapInteval    = TimeSpan.FromMilliseconds(10);
            this.SubmitQueue.BufferReady   += OnSubmitQueueBufferReady;

            this.Notifiers = new Dictionary <string, SmsGateways.HyperCmppNotifier>();
            _isSimulated   = isSimulated;

            SmsServerSessionlist = new List <SmsServerSession>();
        }
示例#3
0
        public SgipSmsClient(SgipConfigurations configuration) : base(configuration)
        {
            this.MessagesFactory = new SgipMessageFactory();

            SmsServerConfigurations serverConfigurations = new SmsServerConfigurations()
            {
                HostName  = configuration.ListenHostName,
                HostPort  = configuration.ListenPort,
                UserName  = configuration.UserName,
                Password  = configuration.Password,
                ServiceID = configuration.ServiceId
            };

            this.Server = new InternalSgipSmsServer(serverConfigurations);
            this.Server.ReportReceived += OnReportReceived;
        }
示例#4
0
        public SgipSmsServer(SmsServerConfigurations configuration) : base(configuration)
        {
            this.MessageFactory = new SgipMessageFactory();


            var clientConfigurations = new SgipConfigurations()
            {
                HostName  = configuration.HostName,
                HostPort  = configuration.ClientPort,
                UserName  = configuration.UserName,
                Password  = configuration.Password,
                ServiceId = configuration.ServiceID
            };

            this.Client = new InternalSgipSmsClient(clientConfigurations);
        }
示例#5
0
        public void TestLifetimeServer()
        {
            SmsServerConfigurations configs1 = new SmsServerConfigurations()
            {
                HostName  = "127.0.0.1",
                HostPort  = 12321,
                UserName  = "******",
                Password  = "******",
                ServiceID = "99999"
            };

            SgipConfigurations configs2 = new SgipConfigurations()
            {
                HostName  = configs1.HostName,
                HostPort  = configs1.HostPort,
                UserName  = configs1.UserName,
                Password  = configs1.Password,
                ServiceId = configs1.ServiceID
            };

            InternalSgipSmsServer server = new InternalSgipSmsServer(configs1);
            SgipSmsClient         client = new SgipSmsClient(configs2);


            var t1 = server.StartAsync(); t1.Wait();
            var t2 = client.StartAsync(); t2.Wait();

            bool isConnected = (client.Status == SmsClientStatus.Connected);

            Debug.WriteLine("Waiting...");

            var tw = Task.Delay(10000); tw.Wait();

            var t11 = client.StopAsync(); t11.Wait();
            var t12 = server.StopAsync(); t12.Wait();

            Assert.IsTrue(isConnected);
        }
示例#6
0
 public InternalSgipSmsServer(SmsServerConfigurations configuration) : base(configuration)
 {
     this.MessageFactory = new SgipMessageFactory();
 }
示例#7
0
 public SmgpSmsServer(SmsServerConfigurations configs) : base(configs)
 {
     this.MessageFactory = new SmgpMessageFactory();
     _serviceId          = configs.ServiceID;
 }