B4R Question Bloqueo durante la reconexión al Servidor

Gustavo Holtermann

Member
Licensed User
Longtime User
Hola, tengo varios módulos ESP8266 que se conectan por WiFi tanto a la PC como a un ANDROID por Socket el tema esta en mientras esta tratando de re conectarse a alguno de ellos el modulo deja de responder por varios segundos, reduje el tiempo haciendo un PING antes de tratar de conectarse porque este demora menos que la re conexión, pero igual si envió algún dato al modulo durante ese tiempo no llega.

En el entorno final no molesta tanto porque hago que intente re conectarse cada un minuto o mas y listo, pero en el entorno de programación molesta bastante esperar ese tiempo para ver si un ajuste esta funcionando.

Hay alguna forma evitar ese tiempo?

Hello, I have several ESP8266 modules that connect via WiFi both to the PC and to an ANDROID by Socket the subject is in while trying to connect to some of them the module stops responding for several seconds, I reduced the time doing a PING Before trying to connect because this delay less than the re connection, but just as if you sent some data to the module during that time does not arrive.

In the final environment does not bother so much because I have to try to re connect every minute or more and ready, but in the programming environment annoying enough wait that time to see if an adjustment is working.

Is there any way to avoid that time?

B4X:
Sub ConectarPC(noUsado As Byte)
    'Primero hago un Ping para ver si el PC esta conectado porque en caso contrario solo demora 1 segundo mientras que el ConnectHost demora 7
    If Main.Ping.PingHost("192.168.2.2",1)=True Then
        If SocketPC.ConnectHost("192.168.2.2",4120)=True Then astreamPC.Initialize(SocketPC.Stream, "astreamPC_NewData", "astreamPC_Error")
    Else
        CallSubPlus("ConectarPC", 10000, 0)
    End If
End Sub
 
Top