ArdanStudios / SMPPClient

SMPP Client in C#
Other
30 stars 33 forks source link

Support #1

Closed eaba closed 8 years ago

eaba commented 8 years ago

Do you still maintain this project?

ardan-bkennedy commented 8 years ago

No, I no longer work in C#.

eaba commented 8 years ago

Can you help me? I am experiencing an issue where the first part of concatenated messages is 173 causing the message to be rejected. How can i fix this?

ardan-bkennedy commented 8 years ago

Not knowing anything, check you are using the proper encoding. If I recall there are several character sets you are use. ASCII7 and Latin

eaba commented 8 years ago

I am using the default encoding(that is 0 and 1). Are you recommending ASCII7 and LATIN?

eaba commented 8 years ago

Can you kindly explain this: maxBytes = Convert.ToInt32(Math.Floor(Convert.ToDouble(maxBytes) * 8 / 7));? I believe thats where the issue is with a 160-6 maxBytes one gets 176!

eaba commented 8 years ago

I replaced SplitMessageOnParts with:

public static List<String> Split(string message, int maxPartLength)
        {
            var result = new List<String>();
            for (var 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;
        }

And this worked for me!!

emakumba commented 8 years ago

@eaba how have you done the replacement? SplitMessageOnParts declaration is List<byte[]> SplitMessageOnParts(byte[] messageBytes, int maxLength) while your split method is List<String> Split(string message, int maxPartLength) Please assist me

ardan-bkennedy commented 8 years ago

I'm excited you got things working. You will need to fork the project since I can't validate the changes. I'm not working on this code base anymore. I wish I had tests but I don't. That is the real problem here. Since I never experienced this problem I am not sure what is different.

eaba commented 8 years ago

@ardan-bkennedy I have sent a pull request! @emakumba check my fork of it!