Send SMS simultaneously from VB.NET

  • Thread starter Thread starter Ricardo_raf7
  • Start date Start date
R

Ricardo_raf7

Guest
I have an application that sends SMS every time a user registers on the computer, I am implementing it with a modem Huaewi e3131 connected via USB.
The problem is when 2 or more users register simultaneously the system does not send all SMS, for example 600 only sends 590.


Try
Dim lockobjet As New Object
SyncLock lockobjet

Serialport.Write("ATZ0" & vbCr)
Serialport.WriteLine("AT+CMGF=1" & vbCr) ' Configurando envio de SMS modo texto
Thread.Sleep(1000) ' Esperar 1 segundo
Serialport.Write("AT+CMGS=" & Chr(34) & Telefono & Chr(34) & vbCr) ' Numero al que se envia el SMS
Serialport.Write(mensaje & Chr(26) & vbCr)
Thread.Sleep(1000) ' Esperar 1 segundo
End SyncLock
Catch Ex As IO.IOException
Dim texto As String
texto = My.Computer.FileSystem.ReadAllText("D:\logerrores.txt")
Dim obj As Object
Dim archivo As Object
obj = CreateObject("Scripting.FileSystemObject")
archivo = obj.CreateTextFile("c:\logerrores.txt")
archivo.Writeline(texto & DateTime.Now.ToString() & " Error envio " & Ex.Message)
archivo.Close()
End Try

How do I control the sending of SMS so that none is lost.
Ricardo Rafael Rivas

Continue reading...
 
Back
Top