1、短信何時拆包。這個問題其實是和手機終端有關的。有的終端是自動拆分成為幾個正常短信進行發送,有的是采用長短信的方式進行發送;待會看協議能看出來;
2、拆包後發送的順序。
如果終端按照幾個正常短信發送,那麽接收端會按照接收到短信的順序分別顯示。顯示出來的是幾條短信。
如果終端按照超長短信拆包發送,短信中心/短信網關會根據協議的要求,將短信按照收到的順序進行Forward。接收端收到其中的任何壹條之後,不會立即顯示。它會拆包,當看到的短信數量小於短信包的數量的時候,不會拼裝。當數量相等的時候,會拼裝出壹條正常短信。我們看看CMPP協議:
//當短信超過70個漢字時短信的第壹部分
E0 00 00 00 //4byte 數據總長度
05 00 00 00 //4byte 命令號
3F 38 0B 01 //4byte 流水號
31 3B 6E 0B A2 84 61 F0 //8byte msg_id
30 35 37 37 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 //21byte Dest_Id
00 00 00 00 00 00 00 00 00 00 //10byte Service_Id
00 //1byte TP_pid
01 //1byte TP_udhi
08 //1byte Msg_Fmt
38 36 31 33 37 35 30 32 34 33 33 30 33 00 00 00 00 00 00 00 00 //21byte Src_terminal_Id
00 //Registered_Delivery
8B //Msg_Length
06 //表示超長短信頭信息的長度
08 //表示以兩個字節的數字mod 65536 作為壹條超長短信的標識
00 2A //定義了壹條超長短信的標識號
02 //超長短信總條數
01 //序號
00 61 00 61 00 61 00 61 00 61 00 61 00 61 00 61 00 61 00 61 4E 00 4E 2A 4E BA 6C //短信內容
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 //8byte Reserved
//當短信超過70個漢字時短信的第二部分
78 00 00 00
05 00 00 00
49 38 0B 01
31 3B 74 8B A2 84 62 0D
30 35 37 37 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00
00
01
08
38 36 31 33 37 35 30 32 34 33 33 30 33 00 00 00 00 00 00 00 00
00
23
06 08 04 00 2A //
02 //超長短信總條數
02 //序號
00 61 00 61 00 61 00 61 00 62 00 62 00 62 00 62 00 62 00 62 00 62 00 62 00 62 00 62 //短信內容
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 //8byte Reserved