hi, all :
my code is here:
so far so good,but ,when i show a msgbox in my activity ,UDP_PacketArrived not work,no data arrived.
log is show
readforce
getdata:.....
readforce
getdata:.....
when msgbox show:
readforce
readforce
readforce
when msgbox close:
getdata
getdata
getdata
readforce
getdata
readforce
getdata
readforce
getdata
i don't want the data be interupt ,who can help me, thanks
my code is here:
B4X:
Sub Process_Globals
Public FirstTime As Boolean=True
Public UDPSocket1 As UDPSocket
Public m_CheckIP As String
Public m_CheckPort As String
End Sub
Sub Service_Create
If FirstTime = True Then
m_CheckIP="192.168.1.20"
m_CheckPort=1200
UDPSocket1.Initialize("UDP", 1200, 5000)
End If
FirstTime = False
End Sub
Sub Service_Start (StartingIntent As Intent)
ReadForce
Log("readforce")
StartServiceAt(Me,DateTime.Now+100,True)
End Sub
Sub Service_Destroy
End Sub
Private Sub WriteString(strWrite As String)
Dim Packet As UDPPacket
Dim Data() As Byte
Dim strCmd As String=strWrite
Data = strCmd.GetBytes("UTF8")
Packet.Initialize(Data, m_CheckIP, m_CheckPort)
UDPSocket1.Send(Packet)
End Sub
Sub ReadForce
'm_SendForceTime=DateTime.Now
Dim strCmd As String="#GT" & Chr(13)
WriteString(strCmd)
End Sub
Sub UDP_PacketArrived (Packet As UDPPacket)
Dim msg As String
msg = BytesToString(Packet.Data, Packet.Offset, Packet.Length,"UTF8")
Log("getdata:" & DateTime.Now & ":" & msg)
End Sub
so far so good,but ,when i show a msgbox in my activity ,UDP_PacketArrived not work,no data arrived.
log is show
readforce
getdata:.....
readforce
getdata:.....
when msgbox show:
readforce
readforce
readforce
when msgbox close:
getdata
getdata
getdata
readforce
getdata
readforce
getdata
readforce
getdata
i don't want the data be interupt ,who can help me, thanks