Receiving long text messages


I have a strange problem: When the modem receives SMS message longer than 160 characters, it sort of messes up the message. Strange marks appear at beginning and at end of the message, in both parts of the message. I tested this with hyperterminal where the message appeared. Why isn’t the message normally divided into two parts? How can i solve the problem?


As I know, the strange marks appear only in the beginning of text message and used as a header (When the TextMode is used).
The strange marks contains seven characters.

,@oPP @ xxxxxxx… -> First Message
,@oPP-­@ xxxxxxx… -> Second Message
,@oPP¨@ xxxxxxx… -> Third Message
,@oPP@? xxxxxxx… -> Fourth Message
,@oPP ? xxxxxxx… -> Fifth Message

@o -> (Second and Third Characters) is a long sms identifier.
oP -> (Fourth and Fifth Characters) is the Message Identifier (Different for each Long SMS)
The last two characters is the message sequence number.

I hope this VB code below can help you to understand the Long SMS
in Text Format (NOT PDU Format)

’ Get the Last Two Characters
strLastTwoChars = Right(strHeader, 2)
’ Get the First and the Last Character
strFirstChar = Left(strLastTwoChars, 1)
strLastChar = Right(strLastTwoChars, 1)

Select Case strFirstChar

    Case " "
        ' Message Sequence #1 or Message Sequence #5
        ' Check The Last Char
        If strLastChar = "@" Then
            ' Message Sequence #1
            intMessageSequenceNumber = 1
            ' Message Sequence #5
            intMessageSequenceNumber = 5
        End If

    Case "­-"
        ' Message Sequence #2 [Possibility]
        If strLastChar = "@" Then
            ' Message Sequence #2
            intMessageSequenceNumber = 2
            ' Message Sequence Number Error #1  ???
            intMessageSequenceNumber = -1
        End If

    Case "@"
        ' Message Sequence #4
        intMessageSequenceNumber = 4

    Case Else
        ' Any Other Characters
        ' Message Sequence #3 [Possibility]
        If strLastChar = "@" Then
            ' Message Sequence #3
            intMessageSequenceNumber = 3
            ' Message Sequence Error #2 ???
            intMessageSequenceNumber = -2
        End If

End Select


Thank you for your answer!

The main problem is like this:

When the modem receives a normal message, it sends it through serial port and my software reads it normally. But when a long sms arrives, the modem sends the message with all those special characters, but my software can’t read the message! Only the sender and time of send. So the message itself is lost.

I use methods and properties of dbComm.dll (tht i found in the net) for using serial port, and there is only one function for reading… it’s called Input. It reads the input buffer until it’s empty, so the message should appear as normal string with those special characters! But it doesn’t and i have no idea why. Besides, the message arrives normally to the hyperTerminal for example.

Anybody got an answer for this?