Hi everyone, i'm trying to use UDP to send packets, but i'm getting some errors.
I tried this code on an iPhoneXR and it works in debug and also in release(last os version)... i tried the same code on an iPhone6 but when it is in release it doesn't work
I need to send a packet, and then wait for the "OK" answer, if the "OK" doens't arrive OR the timer ticks, it send again a packet with the same data.
On iPhone6 it stays stuck on packet "0".
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Thanks in advance!
			
			I tried this code on an iPhoneXR and it works in debug and also in release(last os version)... i tried the same code on an iPhone6 but when it is in release it doesn't work
I need to send a packet, and then wait for the "OK" answer, if the "OK" doens't arrive OR the timer ticks, it send again a packet with the same data.
On iPhone6 it stays stuck on packet "0".
			
				B4X:
			
		
		
		Private Sub Application_Start (Nav As NavigationController)
    'SetDebugAutoFlushLogs(True) 'Uncomment if program crashes before all logs are printed.
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.Title = "Page 1"
    Page1.RootPanel.LoadLayout("1")
    NavControl.ShowPage(Page1)
   
    tmr.Initialize("tmr", 1000)
    'UDPSocket1.Initialize("UDP", 0, 2048)
End Sub
Sub UDP_PacketArrived(Packet As UDPPacket)
   
    Dim msg As String
    msg = BytesToString(Packet.Data, Packet.Offset, Packet.Length, "UTF8")
   
    TextView1.Text = msg & CRLF & TextView1.Text
    TextView1.ScrollTo(0)
   
    If msg == "OK" Then
        res = "OK"
    End If
End Sub
Sub Button1_LongClick
    hud1.ToastMessageShow("Test invio pacchetti inziato", False)
    Dim i As Int = 0
    Dim l As Int = 0
    Dim t As Long = DateTime.Now
    Page1.ResignFocus
    TextView1.Text = ""
   
    Do While (i <= 99) And (tmr.Enabled == False)
        TextView1.Text = i & CRLF & TextView1.Text
        TextView1.ScrollTo(0)
        If UDPSocket1.IsInitialized Then UDPSocket1.Close
        Sleep(400)
        UDPSocket1.Initialize("UDP", 0, 2048)
       
        Dim Packet As UDPPacket
        Dim data() As Byte
        Dim convstring As String = $"${i}"$
        data = convstring.GetBytes("UTF8")
       
        Packet.Initialize(data, "--.---.--.---", 12000)
        UDPSocket1.Send(Packet)
        res = ""
        tmr.Enabled = True
   
        Do While (tmr.Enabled == True) And (res == "")
            Sleep(0)
        Loop
       
        If res == "OK" Then
            i=i+1
        Else
            l=l+1
        End If
       
        tmr.Enabled = False
        Sleep(0)
    Loop
   
    Msgbox("Pacchetti inviati:"&i&CRLF&"Pacchetti persi: "&l&CRLF&"Tempo impiegato: "&DateTime.GetSecond(DateTime.Now - t)&"sec", "Resoconto")
    UDPSocket1.Close
End Sub
Sub tmr_Tick
    tmr.Enabled = False
End Sub
Sub Page1_Click
    Page1.ResignFocus
End SubThanks in advance!
 
				 
 
		 
 
		 
 
		