JamaaSMPP icon indicating copy to clipboard operation
JamaaSMPP copied to clipboard

Receive all SMS in all instances of my SMPP client

Open emmacias opened this issue 4 years ago • 0 comments

Hello, receive a cordial greeting.

Implemented a smpp client as shown below:

public static SmppClient GetSmppClient()
{
    var client = new SmppClient();

    SmppConnectionProperties properties = client.Properties;
    properties.SystemID = "MyID";
    properties.Password = "MyPassword";
    properties.Port = 1234;
    properties.Host = "MyHost";
    properties.SystemType = "smpp";
    properties.DefaultServiceType = "smpp";
    properties.SourceAddress = "6015";
    properties.InterfaceVersion = InterfaceVersion.v34;
    properties.DefaultEncoding = DataCoding.SMSCDefault;
    properties.AddressNpi = NumberingPlanIndicator.ISDN;
    properties.AddressTon = TypeOfNumber.International;

    client.AutoReconnectDelay = 30000;
    client.KeepAliveInterval = 15000;

    return client;
}

private void listenMessageReceived()
{
    client = GetSmppClient();
    client.ConnectionStateChanged += connectionStateChanged;

    if (!client.Started)
    {
        client.ForceConnect();
        client.Start();
    }

    client.MessageReceived += messageReceived;
}

private void messageReceived(object sender, MessageEventArgs e)
{
    TextMessage msg = e.ShortMessage as TextMessage;
    SetSMSDataGridView(DateTime.Now, msg.SourceAddress, msg.DestinationAddress, msg.Text);
}

public void SetSMSDataGridView(DateTime date, string sourceAddress, string destinationAddress, string text)
{
    this.dgvSMS.Rows.Insert(0, date, sourceAddress, destinationAddress, text);
}

The problem is that when I run multiple instances of my program, all SMS are not received in all instances.

As you can see below:

Sin título

Both instances of the program are running at the same time, but the SMS they receive are different.

Thanks for your help.

emmacias avatar May 15 '21 22:05 emmacias