Android Question APP closes on UDP packet reception

Nitin Joshi

Active Member
Licensed User
Hi, I am usnig ESP8266 WiFi module. My APP is communicating with ESP8266 by sending UDP packets. ESP8266 is working as AP. When I send UDP packet, ESP 8266 respond back with message "Success"or "Fail" based on data sent from APP.
When APP receives "Success" packet, I change boolean value (connectionSuccess) to true and when APP receives "Fail"packet, I change boolean value (connectionSuccess) to false.
Now, the problem is, when "Success" packet is received by APP, ït changes boolean value however when APP receives "Fail" packet, my APP automatically gets closed. As APP is connected to ESP8266 AP, I am unable to find the reason.

Code when UDP packet is received

Sub UDP_PacketArrived (Pkt As UDPPacket)
UDPRcvMsg = BytesToString(Pkt.Data, Pkt.Offset, Pkt.Length,"UTF8")
If UDPRcvMsg.SubString2(0,7)="Success" Then
Label3.Text=""
connectionSuccess=True
Else 'If UDPRcvMsg.subString2(0,6)="Failed" Then
Label3.Text="Connection to device is failed. Retry...."
connectionSuccess=False
End If
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Nitin Joshi

Active Member
Licensed User
How can I see the error? My mobile is connected via B4A bridge and I run APP with option Release.
When my APP is running, its is connected to other WiFi network which is generated by ESP8266 board.
 
Upvote 0
Top