Connecting Tech Pros Worldwide Forums | Help | Site Map

Send Message from PC to Mobile using GSM modem

SRN SRN is offline
Newbie
 
Join Date: May 2007
Posts: 3
#1: Jun 18 '07
Hi,

I am doing the coding for send SMS from PC to Mobile Using GSM Modem in ASP.Net Framework 3.
I am having SAMBA GSM modem and i am using the following code that is working fine.
This coding is working fine in first time only. If i click the same button again that will through the following error "A device attached to the system is not functioning" If i restart the system that working fine for first time. I think some objects are referred inside please any body help to solve this problem.



*****Coding Starting****************************************** *********

Protected Sub BtnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnSend.Click
Dim atcCommand As String
Dim sphnPhoneNo As String
Dim cescQuote As Char
Dim s As String
Dim objGsmModem As New System.IO.Ports.SerialPort("COM3")
With objGsmModem
.PortName = "COM3"
.BaudRate = "9600"
.StopBits = IO.Ports.StopBits.One
.DataBits = 8
.Parity = IO.Ports.Parity.None
'.ReadBufferSize = 10000
.ReadTimeout = 1000
'.WriteBufferSize = 10000
.WriteTimeout = 1000
.Handshake = Handshake.RequestToSend
.RtsEnable = True
.DtrEnable = True
.Open()
'for reading sms
'atcCommand = "AT+CMGR=8" 'to read from inbox
'.Write(atcCommand + vbCrLf) 'execute command on buffer
'TextBox1.Text = .ReadExisting()

'for writing sms

s = .ReadExisting()
.Write("AT+CMGF=1" + vbCrLf)
s = .ReadExisting()

cescQuote = Char.ConvertFromUtf32(34)
sphnPhoneNo = "+919840496050"
atcCommand = "AT+CMGS=" + cescQuote + sphnPhoneNo + cescQuote + vbCrLf + "WORLD" + Char.ConvertFromUtf32(26)
' .Write(atcCommand + vbCrLf)
.WriteLine(atcCommand + vbCrLf)
s = .ReadExisting()
.WriteLine("Thank God From App SRN" + Chr(26))
TextBox1.Text = .ReadExisting()

.DiscardOutBuffer()
.DiscardInBuffer()
.Close()
.Dispose()
End With

End Sub

*********Coding End ************************************************** ******

Needs Regular Fix
 
Join Date: Jul 2006
Location: India,Hyderabad
Posts: 367
#2: Jun 19 '07

re: Send Message from PC to Mobile using GSM modem


Hello
You are using ASP.net it sense you can access your application anywhere (if internet is provided ) ,my dout is where you are connecting your GSM Modem at server or at client who ever access your application should connect the modem ? ,


i have developed a windows application using c#2005 post code too in this forum if required just search for that ,

Please reply where you are connecting Your GSM Modem exactly ,Why you are using ASp.net (if you connect the only at server) if so how can you access the hardware from client side,

Hope you will back with some details

Regards
Reply