This project is read-only.

concatenated messages is not included? (clarified)

Aug 9, 2011 at 1:18 PM
Edited Aug 9, 2011 at 1:20 PM

Hi Ben,

You (or who?) wrote following in the Documentation: "As of Beta 1 Release, support for concatenated messages is not included. Out going messages which are more than 160 characters in length will cause an exception to be thrown."

Hm,... I would just carefully say... -> it's not the truth! One can send concatenated messages using your lib. And that is gooooood so!!! :-)
Just tested with following code and using your "JamaaTech.SMPP.Net.Lib":

..... code
// all know connect and submitSm settings here....
//and here:

Udh mmUdh; // initialize Udh
Random mrandom = new Random(); // initialize Random ( C# implemented funktion)

const string minput = "MSG 2: Ich bin nur ein einfacher Musikant der sehr schlecht spielt aber einen guten Willen hat. Das ist aber denen zu wenig, die wollen mehr haben. Mehr geht es aber nicht, ich kann das was ich kann und das ist es!"; // that was my (in german language) LOOONG SMS
            string[] splittedMsg = mmTools.SplitSpecial(minput, 153); // separate simple "split-funktion" which is splitting the message into  string array
            int SegID = mrandom.Next(1000, 9999); // create random SegmentID
            int totalSegments = splittedMsg.Length; // get the number of (how many) parts
            mmUdh = new Udh(SegID, totalSegments, 0); // ID, Total, part
            mmUdh.MessageCount = totalSegments; // message count, get it from totalSegments

            for (int i = 0; i < totalSegments; i++)
                mmUdh.MessageSequence = i + 1;  // seq+1 , - parts of the message      
                mmSubmitSm.SetMessageText(splittedMsg[i], DataCoding.SMSCDefault, mmUdh); // send parts of the message + all othe Udh settings
                mmSubmitSmResp = mmSession.SendPdu(mmSubmitSm) as SubmitSmResp; // send PDU

                richTextBox3.Text = mmSubmitSmResp.MessageID + "\n"; // show message ID
                richTextBox3.Text += mmSubmitSmResp.Header.ErrorCode.ToString() + "\n";   

And this is working! That means YOUR lib is great!! ( it's not clear why you wrote: ... not supported...?)
Any comment's here, Ben? :-) :-) :-)
Aug 10, 2011 at 9:29 PM


Like I mentioned in previous discussions, you can do anything with Jamaa SMPP as long as the SMPP protocol supports it. However, that requires a great deal of knowledge of the SMPP protocol which many people don't have.

To overcome such obstacles, we created another layer of abstraction that provides a programming interface which is much easier to use, but with far less features compared to the underlying library.

As you may have noticed, all tutorials on our project webpage refer to this top layer in which no support for concatenated messages is provided.

Sorry if the statement is misinforming. It refers to the top layer, not the underlying library.


Aug 12, 2011 at 9:21 AM

Hi Ben,

Thanks for clarifying! :-)

Nice day.




Jan 27, 2012 at 12:53 PM

Dear Codexer

I just recived erro_code = ESME_ROK. But no message receive at User Cell. But when i use EasySMPP lip it works fine. I am using VPN to connect SMSC.

Jan 29, 2012 at 6:49 AM


If the message wasn't delivered and you got ESME_ROK you probably should call your gateway provider who will be able to do a trace and

explain what went wrong. If the PDU was sent successfully we should expect the message to be delivered.

Have you tried to check with your gateway provider on this? Can you share the results?


Jan 31, 2012 at 5:43 PM

Thanks bentesha

Finally resolved the issue. But one more issue raised regarding UDH. Some nokia phones not support concatenated messages. Used some above code. Any issue in this code?

Jul 4, 2012 at 5:08 AM
Edited Jul 4, 2012 at 5:20 AM

Hi guys,

As a follow-up to this, I needed concatenated SMS's working, and this library looked the best from all other points of view, so I've gone and implemented the concatenation at the client level.

To implement this, you'll need to modify the GetPDUs function in TextMessage.cs to look like the following:

protected override IEnumerable<SendSmPDU> GetPDUs(DataCoding defaultEncoding)
    //This SMPP implementation does not support sending concatenated messages,
    //however, concatenated messages are supported on the receiving side.

    SubmitSm sm = new SubmitSm();
    sm.SourceAddress.Address = vSourceAddress;
    sm.DestinationAddress.Address = vDestinatinoAddress; // Urgh, typo :(
    sm.DataCoding = defaultEncoding;
    if (vRegisterDeliveryNotification)
        sm.RegisteredDelivery = RegisteredDelivery.DeliveryReceipt;

    int maxLength = GetMaxMessageLength(defaultEncoding, false);
    byte[] bytes = SMPPEncodingUtil.GetBytesFromString(vText, defaultEncoding);

    if (bytes.Length > maxLength) // Split into multiple!
        var SegID = new Random().Next(1000, 9999); // create random SegmentID
        var messages = Split(vText, GetMaxMessageLength(defaultEncoding, true));
        var totalSegments = messages.Count; // get the number of (how many) parts
        var udh = new Udh(SegID, totalSegments, 0); // ID, Total, part

        for (int i = 0; i < totalSegments; i++)
            udh.MessageSequence = i + 1;  // seq+1 , - parts of the message      
            sm.SetMessageText(messages[i], DataCoding.SMSCDefault, udh); // send parts of the message + all other UDH settings
            yield return sm;
        yield return sm;

private static List<String> Split(string message, int maxPartLength)
    var result = new List<String>();

    for (int i = 0; i < message.Length; i += maxPartLength)
        var chunkSize = i + maxPartLength < message.Length ? maxPartLength : message.Length - i;
        var chunk = new char[chunkSize];
        message.CopyTo(i, chunk, 0, chunkSize);
        result.Add(new string(chunk));

    return result;


Beware, I've done very little testing on this code, and you can implement it at your own risk, but "it works on my machine"

Thanks to codexer for the starting-point and hints!


Jul 4, 2012 at 5:27 AM

Great work Pat! Works on my machine too!

Oct 30, 2012 at 11:25 AM
Edited Oct 30, 2012 at 11:49 AM

Hi PHeonix25

Thanks for the great work but you need to replace this line 

sm.SetMessageText(messages[i], DataCoding.SMSCDefault, udh); // here you enforced SMSCDefault coding 



sm.SetMessageText(messages[i], defaultEncoding, udh); // pass default encoding which passed in method prams
Oct 30, 2012 at 12:32 PM
Edited Oct 30, 2012 at 12:32 PM

Hi mfatah,

Thanks for picking that up - I had fixed it in my version, but not updated this thread.
I am sure that there are also some other modifications that I've made to the base-library (like adding a lot more verbose logging with TraceSwitches), that I haven't listed here.

The primary change to the above code would be to allocate the next global id to each PDU packet, which I hadn't done previously and came back to bite me:


for (int i = 0; i < totalSegments; i++)
    udh.MessageSequence = i + 1;
    sm.Header.SequenceNumber = PDUHeader.GetNextSequenceNumber(); // Global locking function to ensure atomicity
    sm.SetMessageText(messages[i], defaultEncoding, udh); // send parts of the message + all other UDH settings
    yield return sm;



Oct 30, 2012 at 4:10 PM

Good Job :) 

Nov 10, 2016 at 3:24 PM
Hi @PHeonix25, the other contributors,

Thank you for your code. Ive been able to implement the above successfully.

But I'm getting an error on this line
sm.Header.SequenceNumber = PDUHeader.GetNextSequenceNumber(); // Global locking function to ensure atomicity

Error => Property or indexer 'JamaaTech.Smpp.Net.Lib.Protocol.PDUHeader.SequenceNumber' cannot be assigned to -- it is read only

Any assistance will be much appreciated