// <SendHelloWorld> public static async Task SendHelloWorld() { using (SmppServer server = new SmppServer(new IPEndPoint(IPAddress.Any, 7777))) { server.Start(); using (SmppClient client = new SmppClient()) { if (await client.Connect("localhost", 7777)) { BindResp bindResp = await client.Bind("1", "2"); if (bindResp.Header.Status == CommandStatus.ESME_ROK) { var submitResp = await client.Submit( SMS.ForSubmit() .From("111") .To("222") .Coding(DataCodings.UCS2) .Text("Hello World!")); if (submitResp.All(x => x.Header.Status == CommandStatus.ESME_ROK)) { client.Logger.Info("Message has been sent."); } } await client.Disconnect(); } } } }
public async Task Run(Uri smscUrl) { _proxyServer.Start(); await _proxyClient.Connect(smscUrl.Host, smscUrl.Port); BindResp bindResp = await _proxyClient.Bind("proxy", "test"); }
private void Run() { _server = new SmppServer(new IPEndPoint(IPAddress.Any, 7777)); _server.evClientConnected += (sender, client) => { }; _server.evClientDisconnected += (sender, client) => { }; _server.evClientSubmitSm += WhenServerReceivesPDU; _server.Start(); }
private void bStartServer_Click(object sender, EventArgs e) { bStartServer.Enabled = false; bStopServer.Enabled = true; if (cbSSL.Checked && comboCertList.SelectedItem != null) { _server.ServerCertificate = (X509Certificate2)comboCertList.SelectedItem; _server.EnabledSslProtocols = SslProtocols.Default; } else { _server.ServerCertificate = null; } _server.Start(); }
public static async Task Run() { // <Sample> using (SmppServer server = new SmppServer(new IPEndPoint(IPAddress.Any, 7777))) { server.EnabledSslProtocols = SslProtocols.Tls12; server.ServerCertificate = new X509Certificate2("server_certificate.p12", "cert_password"); server.Start(); server.evClientConnected += (sender, client) => { var clientCertificate = client.ClientCertificate; //You can validate client certificate and disconnect if it is not valid. }; using (SmppClient client = new SmppClient()) { client.EnabledSslProtocols = SslProtocols.Tls12; //if required you can be authenticated with client certificate client.ClientCertificates.Add(new X509Certificate2("client_certificate.p12", "cert_password")); if (await client.Connect("localhost", 7777)) { BindResp bindResp = await client.Bind("username", "password"); if (bindResp.Header.Status == CommandStatus.ESME_ROK) { var submitResp = await client.Submit( SMS.ForSubmit() .From("111") .To("436641234567") .Coding(DataCodings.UCS2) .Text("Hello World!")); if (submitResp.All(x => x.Header.Status == CommandStatus.ESME_ROK)) { client.Logger.Info("Message has been sent."); } } await client.Disconnect(); } } } //</Sample> }
public static async Task StartApp() { using (SmppServer server = new SmppServer(new IPEndPoint(IPAddress.Any, 7777))) { server.evClientBind += (sender, client, data) => { /*accept all*/ }; server.evClientSubmitSm += (sender, client, data) => { /*receive all*/ }; server.Start(); using (SmppClient client = new SmppClient()) { await client.Connect("localhost", 7777); await client.Bind("username", "password"); Console.WriteLine("Performance: " + await RunTest(client, 50000) + " m/s"); } } }