Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
how do i send a long sms exceeding 160 characters using AT command
this is my code:
Dim isSend As Boolean = False
Try
    Dim recievedData As String = ExecCommand(port, "AT", 300, "No phone connected")
    recievedData = ExecCommand(port, "AT+CMGF=1", 300, "Failed to set message format.")
    Dim command As [String] = "AT+CMGS=""" & PhoneNo & """"
    recievedData = ExecCommand(port, command, 300, "Failed to accept phoneNo")
    command = Message & Char.ConvertFromUtf32(26) & vbCr
    recievedData = ExecCommand(port, command, 3000, "Failed to send message")
    '3 seconds
    If recievedData.EndsWith(vbCr & vbLf & "OK" & vbCr & vbLf) Then
	isSend = True
    ElseIf recievedData.Contains("ERROR") Then
	isSend = False
    End If
    Return isSend
Catch ex As Exception
    Throw ex
End Try
Posted 28-Mar-13 1:15am
Edited 28-Mar-13 2:50am
v2
Comments
Anil Honey 206 at 28-Mar-13 7:29am
   
Your sending Sms through Modem
Ankur\m/ at 28-Mar-13 7:54am
   
Your code seems fine to me. Message Format 1 is PDU mode right? The character limit is in Text mode.
Google and you shall find more details.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

using AT-commands (GSM-device or mobile attached with PC)
May be your device allowing 128 chars only in a single message.
 
you can split long message in two or more sms. because in this case(for AT-commands), if your device support only 128 chars per sms then there are no extra settings available to extend the limit from 128 to 160 chars in your current device.
 
you can also use 3rd party bulk sms service for this...
 
Happy Coding!
Smile | :)
  Permalink  
v4
Comments
Ankur\m/ at 28-Mar-13 7:53am
   
Can you give a reference supporting your statement - "there is no way to extend the limit from 128 to 160 chars".
Because AFAIK, the limit depends upon the modem. And if the modem supports PDU mode, sending sms more than 160 chars is also possible.
Aarti Meswania at 28-Mar-13 8:06am
   
actually I had faced same isuue with GSM modem and mobile also. and I had to partition my long message in to 2 sms (128chars per sms). so, that I shared my experience.
 
and it's good if you sure about "the limit depends modem supports PDU mode, sending sms more than 160 chars is also possible." then please suggest OP that device name or some of manufactures so, this could solve OP's problem.
 
and I am modifying my sentence. "there is no way to extend the limit from 128 to 160 chars." to "there is no way to extend the limit from 128 to 160 chars in your current device."
thanks
:)
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 410
1 Jochen Arndt 200
2 Richard MacCutchan 135
3 DamithSL 105
4 PIEBALDconsult 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100