471,350 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

Send Message from PC to Mobile using GSM modem

3
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 ************************************************** ******
Jun 18 '07 #1
1 3197
nmsreddi
366 256MB
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
Jun 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Ashish | last post: by
5 posts views Thread by tommaso.gastaldi | last post: by
3 posts views Thread by nil | last post: by
reply views Thread by nil | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.