| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/SMSC client .NET/samples/cs-net/SMPP/ |
Upload File : |
//------------------------------------------------------------------------------
// SMSC client .NET components SMPP sample application
//
// $Header: $
// Copyright (c) 2003-2013 Tops. All rights reserved.
//------------------------------------------------------------------------------
using System;
using System.Windows.Forms;
using smscc;
using smscc.SMPP;
using smsce;
using smsce.SMS;
namespace sampleSMPP
{
public class fmMain : System.Windows.Forms.Form
{
public System.Windows.Forms.CheckBox chkStatusReport;
public System.Windows.Forms.TextBox txtUDH;
public System.Windows.Forms.ComboBox cbEncoding;
public System.Windows.Forms.TextBox txtDestTON;
public System.Windows.Forms.TextBox txtDestNPI;
public System.Windows.Forms.TextBox txtOrigTON;
public System.Windows.Forms.TextBox txtOrigNPI;
public System.Windows.Forms.TextBox txtSystemType;
public System.Windows.Forms.TextBox txtOriginator;
public System.Windows.Forms.TextBox txtPassword;
public System.Windows.Forms.Button cmdInitialize;
public System.Windows.Forms.TextBox txtNPI;
public System.Windows.Forms.TextBox txtTON;
public System.Windows.Forms.TextBox txtSystemID;
public System.Windows.Forms.TextBox txtDestination;
public System.Windows.Forms.TextBox txtLog;
public System.Windows.Forms.Button cmdSubmit;
public System.Windows.Forms.TextBox txtSubmit;
public System.Windows.Forms.Button cmdDisconnect;
public System.Windows.Forms.TextBox txtPort;
public System.Windows.Forms.TextBox txtHost;
public System.Windows.Forms.Button cmdConnect;
public System.Windows.Forms.Label Label17;
public System.Windows.Forms.Label Line2;
public System.Windows.Forms.Label Label16;
public System.Windows.Forms.Label Line1;
public System.Windows.Forms.Label Line5;
public System.Windows.Forms.Label Label15;
public System.Windows.Forms.Label Label14;
public System.Windows.Forms.Label Label11;
public System.Windows.Forms.Label Label13;
public System.Windows.Forms.Label Label12;
public System.Windows.Forms.Label Label10;
public System.Windows.Forms.Label Label9;
public System.Windows.Forms.Label Label8;
public System.Windows.Forms.Label Label7;
public System.Windows.Forms.Label Label6;
public System.Windows.Forms.Label Label5;
public System.Windows.Forms.Label Label4;
public System.Windows.Forms.Label Label3;
public System.Windows.Forms.Label Label2;
public System.Windows.Forms.Label Label1;
public System.Windows.Forms.CheckBox chkDirectDisplay;
private SMSCclientSMPP SMSCclientSMPP;
private System.ComponentModel.Container components = null;
public fmMain()
{
InitializeComponent();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.chkStatusReport = new System.Windows.Forms.CheckBox();
this.txtUDH = new System.Windows.Forms.TextBox();
this.cbEncoding = new System.Windows.Forms.ComboBox();
this.txtDestTON = new System.Windows.Forms.TextBox();
this.txtDestNPI = new System.Windows.Forms.TextBox();
this.txtOrigTON = new System.Windows.Forms.TextBox();
this.txtOrigNPI = new System.Windows.Forms.TextBox();
this.txtSystemType = new System.Windows.Forms.TextBox();
this.txtOriginator = new System.Windows.Forms.TextBox();
this.txtPassword = new System.Windows.Forms.TextBox();
this.cmdInitialize = new System.Windows.Forms.Button();
this.txtNPI = new System.Windows.Forms.TextBox();
this.txtTON = new System.Windows.Forms.TextBox();
this.txtSystemID = new System.Windows.Forms.TextBox();
this.txtDestination = new System.Windows.Forms.TextBox();
this.txtLog = new System.Windows.Forms.TextBox();
this.cmdSubmit = new System.Windows.Forms.Button();
this.txtSubmit = new System.Windows.Forms.TextBox();
this.cmdDisconnect = new System.Windows.Forms.Button();
this.txtPort = new System.Windows.Forms.TextBox();
this.txtHost = new System.Windows.Forms.TextBox();
this.cmdConnect = new System.Windows.Forms.Button();
this.Label17 = new System.Windows.Forms.Label();
this.Line2 = new System.Windows.Forms.Label();
this.Label16 = new System.Windows.Forms.Label();
this.Line1 = new System.Windows.Forms.Label();
this.Line5 = new System.Windows.Forms.Label();
this.Label15 = new System.Windows.Forms.Label();
this.Label14 = new System.Windows.Forms.Label();
this.Label11 = new System.Windows.Forms.Label();
this.Label13 = new System.Windows.Forms.Label();
this.Label12 = new System.Windows.Forms.Label();
this.Label10 = new System.Windows.Forms.Label();
this.Label9 = new System.Windows.Forms.Label();
this.Label8 = new System.Windows.Forms.Label();
this.Label7 = new System.Windows.Forms.Label();
this.Label6 = new System.Windows.Forms.Label();
this.Label5 = new System.Windows.Forms.Label();
this.Label4 = new System.Windows.Forms.Label();
this.Label3 = new System.Windows.Forms.Label();
this.Label2 = new System.Windows.Forms.Label();
this.Label1 = new System.Windows.Forms.Label();
this.chkDirectDisplay = new System.Windows.Forms.CheckBox();
this.SMSCclientSMPP = new smscc.SMPP.SMSCclientSMPP();
this.SuspendLayout();
//
// chkStatusReport
//
this.chkStatusReport.BackColor = System.Drawing.SystemColors.Control;
this.chkStatusReport.Checked = true;
this.chkStatusReport.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkStatusReport.Cursor = System.Windows.Forms.Cursors.Default;
this.chkStatusReport.ForeColor = System.Drawing.SystemColors.ControlText;
this.chkStatusReport.Location = new System.Drawing.Point(100, 400);
this.chkStatusReport.Name = "chkStatusReport";
this.chkStatusReport.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.chkStatusReport.Size = new System.Drawing.Size(216, 17);
this.chkStatusReport.TabIndex = 20;
this.chkStatusReport.Text = "Request status report for the message";
this.chkStatusReport.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.chkStatusReport.UseVisualStyleBackColor = false;
//
// txtUDH
//
this.txtUDH.AcceptsReturn = true;
this.txtUDH.BackColor = System.Drawing.SystemColors.Window;
this.txtUDH.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtUDH.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtUDH.Location = new System.Drawing.Point(100, 332);
this.txtUDH.MaxLength = 0;
this.txtUDH.Multiline = true;
this.txtUDH.Name = "txtUDH";
this.txtUDH.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtUDH.Size = new System.Drawing.Size(201, 33);
this.txtUDH.TabIndex = 18;
//
// cbEncoding
//
this.cbEncoding.BackColor = System.Drawing.SystemColors.Window;
this.cbEncoding.Cursor = System.Windows.Forms.Cursors.Default;
this.cbEncoding.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbEncoding.ForeColor = System.Drawing.SystemColors.WindowText;
this.cbEncoding.Items.AddRange(new object[] {
"7 bit encoded text",
"8 bit encoded data",
"UCS2 encoded text"});
this.cbEncoding.Location = new System.Drawing.Point(100, 368);
this.cbEncoding.Name = "cbEncoding";
this.cbEncoding.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cbEncoding.Size = new System.Drawing.Size(201, 21);
this.cbEncoding.TabIndex = 19;
//
// txtDestTON
//
this.txtDestTON.AcceptsReturn = true;
this.txtDestTON.BackColor = System.Drawing.SystemColors.Window;
this.txtDestTON.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtDestTON.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtDestTON.Location = new System.Drawing.Point(100, 252);
this.txtDestTON.MaxLength = 0;
this.txtDestTON.Name = "txtDestTON";
this.txtDestTON.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtDestTON.Size = new System.Drawing.Size(65, 20);
this.txtDestTON.TabIndex = 15;
this.txtDestTON.Text = "1";
//
// txtDestNPI
//
this.txtDestNPI.AcceptsReturn = true;
this.txtDestNPI.BackColor = System.Drawing.SystemColors.Window;
this.txtDestNPI.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtDestNPI.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtDestNPI.Location = new System.Drawing.Point(236, 252);
this.txtDestNPI.MaxLength = 0;
this.txtDestNPI.Name = "txtDestNPI";
this.txtDestNPI.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtDestNPI.Size = new System.Drawing.Size(65, 20);
this.txtDestNPI.TabIndex = 16;
this.txtDestNPI.Text = "1";
//
// txtOrigTON
//
this.txtOrigTON.AcceptsReturn = true;
this.txtOrigTON.BackColor = System.Drawing.SystemColors.Window;
this.txtOrigTON.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtOrigTON.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtOrigTON.Location = new System.Drawing.Point(100, 204);
this.txtOrigTON.MaxLength = 0;
this.txtOrigTON.Name = "txtOrigTON";
this.txtOrigTON.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtOrigTON.Size = new System.Drawing.Size(65, 20);
this.txtOrigTON.TabIndex = 12;
this.txtOrigTON.Text = "1";
//
// txtOrigNPI
//
this.txtOrigNPI.AcceptsReturn = true;
this.txtOrigNPI.BackColor = System.Drawing.SystemColors.Window;
this.txtOrigNPI.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtOrigNPI.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtOrigNPI.Location = new System.Drawing.Point(236, 204);
this.txtOrigNPI.MaxLength = 0;
this.txtOrigNPI.Name = "txtOrigNPI";
this.txtOrigNPI.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtOrigNPI.Size = new System.Drawing.Size(65, 20);
this.txtOrigNPI.TabIndex = 13;
this.txtOrigNPI.Text = "1";
//
// txtSystemType
//
this.txtSystemType.AcceptsReturn = true;
this.txtSystemType.BackColor = System.Drawing.SystemColors.Window;
this.txtSystemType.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtSystemType.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtSystemType.ImeMode = System.Windows.Forms.ImeMode.Disable;
this.txtSystemType.Location = new System.Drawing.Point(100, 136);
this.txtSystemType.MaxLength = 0;
this.txtSystemType.Name = "txtSystemType";
this.txtSystemType.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtSystemType.Size = new System.Drawing.Size(117, 20);
this.txtSystemType.TabIndex = 10;
//
// txtOriginator
//
this.txtOriginator.AcceptsReturn = true;
this.txtOriginator.BackColor = System.Drawing.SystemColors.Window;
this.txtOriginator.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtOriginator.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtOriginator.Location = new System.Drawing.Point(100, 180);
this.txtOriginator.MaxLength = 0;
this.txtOriginator.Name = "txtOriginator";
this.txtOriginator.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtOriginator.Size = new System.Drawing.Size(201, 20);
this.txtOriginator.TabIndex = 11;
//
// txtPassword
//
this.txtPassword.AcceptsReturn = true;
this.txtPassword.BackColor = System.Drawing.SystemColors.Window;
this.txtPassword.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtPassword.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtPassword.Location = new System.Drawing.Point(100, 112);
this.txtPassword.MaxLength = 0;
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtPassword.Size = new System.Drawing.Size(117, 20);
this.txtPassword.TabIndex = 8;
//
// cmdInitialize
//
this.cmdInitialize.BackColor = System.Drawing.SystemColors.Control;
this.cmdInitialize.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdInitialize.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdInitialize.Location = new System.Drawing.Point(320, 88);
this.cmdInitialize.Name = "cmdInitialize";
this.cmdInitialize.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdInitialize.Size = new System.Drawing.Size(69, 23);
this.cmdInitialize.TabIndex = 2;
this.cmdInitialize.Text = "Initialize";
this.cmdInitialize.UseVisualStyleBackColor = false;
this.cmdInitialize.Click += new System.EventHandler(this.cmdInitialize_Click);
//
// txtNPI
//
this.txtNPI.AcceptsReturn = true;
this.txtNPI.BackColor = System.Drawing.SystemColors.Window;
this.txtNPI.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtNPI.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtNPI.Location = new System.Drawing.Point(260, 112);
this.txtNPI.MaxLength = 0;
this.txtNPI.Name = "txtNPI";
this.txtNPI.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtNPI.Size = new System.Drawing.Size(41, 20);
this.txtNPI.TabIndex = 9;
this.txtNPI.Text = "1";
//
// txtTON
//
this.txtTON.AcceptsReturn = true;
this.txtTON.BackColor = System.Drawing.SystemColors.Window;
this.txtTON.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtTON.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtTON.Location = new System.Drawing.Point(260, 88);
this.txtTON.MaxLength = 0;
this.txtTON.Name = "txtTON";
this.txtTON.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtTON.Size = new System.Drawing.Size(41, 20);
this.txtTON.TabIndex = 7;
this.txtTON.Text = "1";
//
// txtSystemID
//
this.txtSystemID.AcceptsReturn = true;
this.txtSystemID.BackColor = System.Drawing.SystemColors.Window;
this.txtSystemID.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtSystemID.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtSystemID.Location = new System.Drawing.Point(100, 88);
this.txtSystemID.MaxLength = 0;
this.txtSystemID.Name = "txtSystemID";
this.txtSystemID.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtSystemID.Size = new System.Drawing.Size(117, 20);
this.txtSystemID.TabIndex = 6;
//
// txtDestination
//
this.txtDestination.AcceptsReturn = true;
this.txtDestination.BackColor = System.Drawing.SystemColors.Window;
this.txtDestination.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtDestination.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtDestination.Location = new System.Drawing.Point(100, 228);
this.txtDestination.MaxLength = 0;
this.txtDestination.Name = "txtDestination";
this.txtDestination.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtDestination.Size = new System.Drawing.Size(201, 20);
this.txtDestination.TabIndex = 14;
//
// txtLog
//
this.txtLog.AcceptsReturn = true;
this.txtLog.BackColor = System.Drawing.SystemColors.Window;
this.txtLog.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtLog.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtLog.Location = new System.Drawing.Point(20, 464);
this.txtLog.MaxLength = 0;
this.txtLog.Multiline = true;
this.txtLog.Name = "txtLog";
this.txtLog.ReadOnly = true;
this.txtLog.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtLog.Size = new System.Drawing.Size(373, 101);
this.txtLog.TabIndex = 22;
this.txtLog.WordWrap = false;
//
// cmdSubmit
//
this.cmdSubmit.BackColor = System.Drawing.SystemColors.Control;
this.cmdSubmit.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdSubmit.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdSubmit.Location = new System.Drawing.Point(320, 180);
this.cmdSubmit.Name = "cmdSubmit";
this.cmdSubmit.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdSubmit.Size = new System.Drawing.Size(69, 23);
this.cmdSubmit.TabIndex = 3;
this.cmdSubmit.Text = "Submit";
this.cmdSubmit.UseVisualStyleBackColor = false;
this.cmdSubmit.Click += new System.EventHandler(this.cmdSubmit_Click);
//
// txtSubmit
//
this.txtSubmit.AcceptsReturn = true;
this.txtSubmit.BackColor = System.Drawing.SystemColors.Window;
this.txtSubmit.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtSubmit.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtSubmit.Location = new System.Drawing.Point(100, 276);
this.txtSubmit.MaxLength = 0;
this.txtSubmit.Multiline = true;
this.txtSubmit.Name = "txtSubmit";
this.txtSubmit.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtSubmit.Size = new System.Drawing.Size(201, 53);
this.txtSubmit.TabIndex = 17;
//
// cmdDisconnect
//
this.cmdDisconnect.BackColor = System.Drawing.SystemColors.Control;
this.cmdDisconnect.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdDisconnect.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdDisconnect.Location = new System.Drawing.Point(320, 44);
this.cmdDisconnect.Name = "cmdDisconnect";
this.cmdDisconnect.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdDisconnect.Size = new System.Drawing.Size(69, 23);
this.cmdDisconnect.TabIndex = 1;
this.cmdDisconnect.Text = "Disconnect";
this.cmdDisconnect.UseVisualStyleBackColor = false;
this.cmdDisconnect.Click += new System.EventHandler(this.cmdDisconnect_Click);
//
// txtPort
//
this.txtPort.AcceptsReturn = true;
this.txtPort.BackColor = System.Drawing.SystemColors.Window;
this.txtPort.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtPort.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtPort.Location = new System.Drawing.Point(260, 12);
this.txtPort.MaxLength = 0;
this.txtPort.Name = "txtPort";
this.txtPort.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtPort.Size = new System.Drawing.Size(41, 20);
this.txtPort.TabIndex = 5;
this.txtPort.Text = "0";
//
// txtHost
//
this.txtHost.AcceptsReturn = true;
this.txtHost.BackColor = System.Drawing.SystemColors.Window;
this.txtHost.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtHost.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtHost.Location = new System.Drawing.Point(100, 12);
this.txtHost.MaxLength = 0;
this.txtHost.Name = "txtHost";
this.txtHost.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.txtHost.Size = new System.Drawing.Size(117, 20);
this.txtHost.TabIndex = 4;
this.txtHost.Text = "0.0.0.0";
//
// cmdConnect
//
this.cmdConnect.BackColor = System.Drawing.SystemColors.Control;
this.cmdConnect.Cursor = System.Windows.Forms.Cursors.Default;
this.cmdConnect.ForeColor = System.Drawing.SystemColors.ControlText;
this.cmdConnect.Location = new System.Drawing.Point(320, 12);
this.cmdConnect.Name = "cmdConnect";
this.cmdConnect.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.cmdConnect.Size = new System.Drawing.Size(69, 23);
this.cmdConnect.TabIndex = 0;
this.cmdConnect.Text = "Connect";
this.cmdConnect.UseVisualStyleBackColor = false;
this.cmdConnect.Click += new System.EventHandler(this.cmdConnect_Click);
//
// Label17
//
this.Label17.AutoSize = true;
this.Label17.BackColor = System.Drawing.SystemColors.Control;
this.Label17.Cursor = System.Windows.Forms.Cursors.Default;
this.Label17.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label17.Location = new System.Drawing.Point(20, 448);
this.Label17.Name = "Label17";
this.Label17.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label17.Size = new System.Drawing.Size(55, 13);
this.Label17.TabIndex = 84;
this.Label17.Text = "Event log:";
//
// Line2
//
this.Line2.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.Line2.Location = new System.Drawing.Point(16, 440);
this.Line2.Name = "Line2";
this.Line2.Size = new System.Drawing.Size(380, 1);
this.Line2.TabIndex = 85;
//
// Label16
//
this.Label16.BackColor = System.Drawing.SystemColors.Control;
this.Label16.Cursor = System.Windows.Forms.Cursors.Default;
this.Label16.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label16.Location = new System.Drawing.Point(20, 332);
this.Label16.Name = "Label16";
this.Label16.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label16.Size = new System.Drawing.Size(57, 29);
this.Label16.TabIndex = 83;
this.Label16.Text = "User Data Header:";
//
// Line1
//
this.Line1.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.Line1.Location = new System.Drawing.Point(16, 76);
this.Line1.Name = "Line1";
this.Line1.Size = new System.Drawing.Size(380, 1);
this.Line1.TabIndex = 86;
//
// Line5
//
this.Line5.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.Line5.Location = new System.Drawing.Point(16, 168);
this.Line5.Name = "Line5";
this.Line5.Size = new System.Drawing.Size(380, 1);
this.Line5.TabIndex = 87;
//
// Label15
//
this.Label15.BackColor = System.Drawing.SystemColors.Control;
this.Label15.Cursor = System.Windows.Forms.Cursors.Default;
this.Label15.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label15.Location = new System.Drawing.Point(20, 372);
this.Label15.Name = "Label15";
this.Label15.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label15.Size = new System.Drawing.Size(57, 13);
this.Label15.TabIndex = 82;
this.Label15.Text = "Encoding:";
//
// Label14
//
this.Label14.AutoSize = true;
this.Label14.BackColor = System.Drawing.SystemColors.Control;
this.Label14.Cursor = System.Windows.Forms.Cursors.Default;
this.Label14.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label14.Location = new System.Drawing.Point(184, 256);
this.Label14.Name = "Label14";
this.Label14.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label14.Size = new System.Drawing.Size(56, 13);
this.Label14.TabIndex = 81;
this.Label14.Text = "Dest. NPI:";
//
// Label11
//
this.Label11.AutoSize = true;
this.Label11.BackColor = System.Drawing.SystemColors.Control;
this.Label11.Cursor = System.Windows.Forms.Cursors.Default;
this.Label11.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label11.Location = new System.Drawing.Point(20, 256);
this.Label11.Name = "Label11";
this.Label11.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label11.Size = new System.Drawing.Size(61, 13);
this.Label11.TabIndex = 80;
this.Label11.Text = "Dest. TON:";
//
// Label13
//
this.Label13.AutoSize = true;
this.Label13.BackColor = System.Drawing.SystemColors.Control;
this.Label13.Cursor = System.Windows.Forms.Cursors.Default;
this.Label13.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label13.Location = new System.Drawing.Point(184, 208);
this.Label13.Name = "Label13";
this.Label13.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label13.Size = new System.Drawing.Size(53, 13);
this.Label13.TabIndex = 79;
this.Label13.Text = "Orig. NPI:";
//
// Label12
//
this.Label12.AutoSize = true;
this.Label12.BackColor = System.Drawing.SystemColors.Control;
this.Label12.Cursor = System.Windows.Forms.Cursors.Default;
this.Label12.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label12.Location = new System.Drawing.Point(20, 208);
this.Label12.Name = "Label12";
this.Label12.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label12.Size = new System.Drawing.Size(58, 13);
this.Label12.TabIndex = 78;
this.Label12.Text = "Orig. TON:";
//
// Label10
//
this.Label10.AutoSize = true;
this.Label10.BackColor = System.Drawing.SystemColors.Control;
this.Label10.Cursor = System.Windows.Forms.Cursors.Default;
this.Label10.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label10.Location = new System.Drawing.Point(20, 140);
this.Label10.Name = "Label10";
this.Label10.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label10.Size = new System.Drawing.Size(71, 13);
this.Label10.TabIndex = 77;
this.Label10.Text = "System Type:";
//
// Label9
//
this.Label9.AutoSize = true;
this.Label9.BackColor = System.Drawing.SystemColors.Control;
this.Label9.Cursor = System.Windows.Forms.Cursors.Default;
this.Label9.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label9.Location = new System.Drawing.Point(20, 184);
this.Label9.Name = "Label9";
this.Label9.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label9.Size = new System.Drawing.Size(55, 13);
this.Label9.TabIndex = 76;
this.Label9.Text = "Originator:";
//
// Label8
//
this.Label8.AutoSize = true;
this.Label8.BackColor = System.Drawing.SystemColors.Control;
this.Label8.Cursor = System.Windows.Forms.Cursors.Default;
this.Label8.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label8.Location = new System.Drawing.Point(20, 116);
this.Label8.Name = "Label8";
this.Label8.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label8.Size = new System.Drawing.Size(56, 13);
this.Label8.TabIndex = 75;
this.Label8.Text = "Password:";
//
// Label7
//
this.Label7.AutoSize = true;
this.Label7.BackColor = System.Drawing.SystemColors.Control;
this.Label7.Cursor = System.Windows.Forms.Cursors.Default;
this.Label7.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label7.Location = new System.Drawing.Point(20, 280);
this.Label7.Name = "Label7";
this.Label7.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label7.Size = new System.Drawing.Size(53, 13);
this.Label7.TabIndex = 74;
this.Label7.Text = "Message:";
//
// Label6
//
this.Label6.AutoSize = true;
this.Label6.BackColor = System.Drawing.SystemColors.Control;
this.Label6.Cursor = System.Windows.Forms.Cursors.Default;
this.Label6.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label6.Location = new System.Drawing.Point(20, 232);
this.Label6.Name = "Label6";
this.Label6.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label6.Size = new System.Drawing.Size(63, 13);
this.Label6.TabIndex = 73;
this.Label6.Text = "Destination:";
//
// Label5
//
this.Label5.AutoSize = true;
this.Label5.BackColor = System.Drawing.SystemColors.Control;
this.Label5.Cursor = System.Windows.Forms.Cursors.Default;
this.Label5.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label5.Location = new System.Drawing.Point(224, 116);
this.Label5.Name = "Label5";
this.Label5.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label5.Size = new System.Drawing.Size(28, 13);
this.Label5.TabIndex = 72;
this.Label5.Text = "NPI:";
//
// Label4
//
this.Label4.AutoSize = true;
this.Label4.BackColor = System.Drawing.SystemColors.Control;
this.Label4.Cursor = System.Windows.Forms.Cursors.Default;
this.Label4.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label4.Location = new System.Drawing.Point(224, 92);
this.Label4.Name = "Label4";
this.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label4.Size = new System.Drawing.Size(33, 13);
this.Label4.TabIndex = 71;
this.Label4.Text = "TON:";
//
// Label3
//
this.Label3.AutoSize = true;
this.Label3.BackColor = System.Drawing.SystemColors.Control;
this.Label3.Cursor = System.Windows.Forms.Cursors.Default;
this.Label3.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label3.Location = new System.Drawing.Point(20, 92);
this.Label3.Name = "Label3";
this.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label3.Size = new System.Drawing.Size(58, 13);
this.Label3.TabIndex = 70;
this.Label3.Text = "System ID:";
this.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// Label2
//
this.Label2.AutoSize = true;
this.Label2.BackColor = System.Drawing.SystemColors.Control;
this.Label2.Cursor = System.Windows.Forms.Cursors.Default;
this.Label2.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label2.Location = new System.Drawing.Point(224, 16);
this.Label2.Name = "Label2";
this.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label2.Size = new System.Drawing.Size(29, 13);
this.Label2.TabIndex = 69;
this.Label2.Text = "Port:";
//
// Label1
//
this.Label1.AutoSize = true;
this.Label1.BackColor = System.Drawing.SystemColors.Control;
this.Label1.Cursor = System.Windows.Forms.Cursors.Default;
this.Label1.ForeColor = System.Drawing.SystemColors.ControlText;
this.Label1.Location = new System.Drawing.Point(20, 16);
this.Label1.Name = "Label1";
this.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Label1.Size = new System.Drawing.Size(80, 13);
this.Label1.TabIndex = 67;
this.Label1.Text = "SMSC address:";
//
// chkDirectDisplay
//
this.chkDirectDisplay.BackColor = System.Drawing.SystemColors.Control;
this.chkDirectDisplay.Cursor = System.Windows.Forms.Cursors.Default;
this.chkDirectDisplay.ForeColor = System.Drawing.SystemColors.ControlText;
this.chkDirectDisplay.Location = new System.Drawing.Point(100, 416);
this.chkDirectDisplay.Name = "chkDirectDisplay";
this.chkDirectDisplay.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.chkDirectDisplay.Size = new System.Drawing.Size(201, 17);
this.chkDirectDisplay.TabIndex = 21;
this.chkDirectDisplay.Text = "Direct display (Flash SMS)";
this.chkDirectDisplay.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.chkDirectDisplay.UseVisualStyleBackColor = false;
//
// SMSCclientSMPP
//
this.SMSCclientSMPP.ImmediateResponse = false;
this.SMSCclientSMPP.KeepAliveInterval = 10;
this.SMSCclientSMPP.ResponseTimeOut = 10;
this.SMSCclientSMPP.ThrottleRate = 0;
this.SMSCclientSMPP.OnSmppTraceProtocol += new smscc.SMPP.smppTraceProtocolCallback(this.SMSCclientSMPP_OnSmppTraceProtocol);
this.SMSCclientSMPP.OnSmppMessageReceived += new smscc.SMPP.smppMessageReceivedEvent(this.SMSCRelaySMPP_OnSmppMessageReceived);
this.SMSCclientSMPP.OnSmppStatusReportReceived += new smscc.SMPP.smppStatusReportReceivedEvent(this.SMSCRelaySMPP_OnSmppStatusReportReceived);
this.SMSCclientSMPP.OnTcpDisconnected += new smscc.tcpDisconnectedEvent(this.SMSCRelaySMPP_OnTcpDisconnected);
//
// fmMain
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(414, 586);
this.Controls.Add(this.chkStatusReport);
this.Controls.Add(this.txtUDH);
this.Controls.Add(this.cbEncoding);
this.Controls.Add(this.txtDestTON);
this.Controls.Add(this.txtDestNPI);
this.Controls.Add(this.txtOrigTON);
this.Controls.Add(this.txtOrigNPI);
this.Controls.Add(this.txtSystemType);
this.Controls.Add(this.txtOriginator);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.cmdInitialize);
this.Controls.Add(this.txtNPI);
this.Controls.Add(this.txtTON);
this.Controls.Add(this.txtSystemID);
this.Controls.Add(this.txtDestination);
this.Controls.Add(this.txtLog);
this.Controls.Add(this.cmdSubmit);
this.Controls.Add(this.txtSubmit);
this.Controls.Add(this.cmdDisconnect);
this.Controls.Add(this.txtPort);
this.Controls.Add(this.txtHost);
this.Controls.Add(this.cmdConnect);
this.Controls.Add(this.Label17);
this.Controls.Add(this.Line2);
this.Controls.Add(this.Label16);
this.Controls.Add(this.Line1);
this.Controls.Add(this.Line5);
this.Controls.Add(this.Label15);
this.Controls.Add(this.Label14);
this.Controls.Add(this.Label11);
this.Controls.Add(this.Label13);
this.Controls.Add(this.Label12);
this.Controls.Add(this.Label10);
this.Controls.Add(this.Label9);
this.Controls.Add(this.Label8);
this.Controls.Add(this.Label7);
this.Controls.Add(this.Label6);
this.Controls.Add(this.Label5);
this.Controls.Add(this.Label4);
this.Controls.Add(this.Label3);
this.Controls.Add(this.Label2);
this.Controls.Add(this.Label1);
this.Controls.Add(this.chkDirectDisplay);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "fmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SMSC client .NET SMPP sample";
this.Load += new System.EventHandler(this.fmMain_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private EventLog Log;
private SMSCencoder en;
uint MySequenceNumber = 1000;
[STAThread]
static void Main()
{
Application.Run(new fmMain());
}
// Connect to SMSC
private void cmdConnect_Click(object sender, System.EventArgs e)
{
int Result;
txtLog.Text = "";
txtLog.Refresh();
Result = SMSCclientSMPP.tcpConnect(txtHost.Text, int.Parse(txtPort.Text), "");
if (Result != 0)
Log.AddConnectionErrorEvent(Result);
else
Log.AddConnectedEvent();
}
// Disonnect from SMSC
private void cmdDisconnect_Click(object sender, System.EventArgs e)
{
SMSCclientSMPP.tcpDisconnect();
}
// Initialize session with SMSC
private void cmdInitialize_Click(object sender, System.EventArgs e)
{
int Result;
Result = SMSCclientSMPP.smppInitializeSession(txtSystemID.Text, txtPassword.Text, byte.Parse(txtTON.Text), byte.Parse(txtNPI.Text), txtSystemType.Text);
if (Result != 0)
Log.AddInitializationErrorEvent(Result);
else
Log.AddInitializedEvent();
}
// Submit message to the SMSC
private void cmdSubmit_Click(object sender, System.EventArgs e)
{
int Result;
string MessageID;
EncodingEnum Encoding;
int Options;
switch (cbEncoding.SelectedIndex)
{
case 2:
Encoding = EncodingEnum.etUCS2Text;
break;
case 1:
Encoding = EncodingEnum.et8BitHexadecimal;
break;
default:
Encoding = EncodingEnum.et7BitText;
break;
}
Options = 0;
if (chkStatusReport.CheckState == CheckState.Checked)
Options |= (int)SubmitOptionEnum.soRequestStatusReport;
if (chkDirectDisplay.CheckState == CheckState.Checked)
Options |= (int)SubmitOptionEnum.soDirectDisplay;
MultipartMessage em = en.EncodeMultipartMessage(SplitMethodEnum.smUDH, txtSubmit.Text, "", Encoding, "");
foreach (MessagePart mp in em.Parts)
{
Result = SMSCclientSMPP.smppSubmitMessageEx(txtDestination.Text, byte.Parse(txtDestTON.Text),
byte.Parse(txtDestNPI.Text), txtOriginator.Text, byte.Parse(txtOrigTON.Text),
byte.Parse(txtOrigNPI.Text), mp.Content, Encoding, mp.UDH, Options,
DateTime.Now, DateTime.Now, "", 0, mp.ExtendedParameters, out MessageID);
if (Result != 0)
Log.AddMessageSubmissionErrorEvent(Result);
else
Log.AddMessageSubmitedEvent(MessageID);
}
}
private void fmMain_Load(object sender, System.EventArgs e)
{
Log = new EventLog(txtLog);
en = new SMSCencoder();
cbEncoding.SelectedIndex = 0;
}
// Disconnected from SMSC
private void SMSCRelaySMPP_OnTcpDisconnected(object sender, tcpDisconnectedEventArgs e)
{
Log.AddDisconnectedEvent(e.Reason);
}
// Message received from SMSC
private void SMSCRelaySMPP_OnSmppMessageReceived(object sender, smppMessageReceivedEventArgs e)
{
EncodedMessage em = en.AddMessageToDecode(e.Destination, e.Originator,
e.Content, e.UserDataHeader, e.Encoding, e.ExtendedParameters);
if (em != null)
{
if (em is NoDecodingNeededMessage)
{
Log.AddMessageReceivedEvent(e.Destination, e.Originator,
e.Content, e.Encoding, e.UserDataHeader);
//
// The message is neither a multipart message nor
// message that can be decoded by the library.
//
// User application has to process such a message on it's own.
//
}
else if (em is MultipartMessage)
{
//
// Concatenated multipart message text is contained in:
//
// ((MultipartMessage)em).Content
//
// User Data Header received in messages (apart
// concatenation header) is contained in:
//
// ((MultipartMessage)em).UDH
//
Log.AddMessageReceivedEvent(e.Destination, e.Originator,
((MultipartMessage)em).Content, e.Encoding, ((MultipartMessage)em).UDH);
}
}
}
// Status Report (SR) received from SMSC
private void SMSCRelaySMPP_OnSmppStatusReportReceived(object sender, smppStatusReportReceivedEventArgs e)
{
Log.AddStatusReportReceivedEvent(e.MessageID, e.Destination, e.Originator, e.MessageState, e.NetworkErrorCode);
}
private void SMSCclientSMPP_OnSmppTraceProtocol(object Sender, smppTraceProtocolCallbackArgs e)
{
if (String.Equals(e.ToAddress, txtHost.Text + ":" + txtPort.Text) && (e.CommandID < 0x80000000))
{
e.SequenceNumber = MySequenceNumber++;
}
}
}
}