b4a 1.50 Bug ?

alibaba

Member
Licensed User
Longtime User
I send data over tcp with a socket an randomaccessfile all work under 1.30
but not under 1.50, now i have changed the randomaccessfile and network libs by booth to the newest versions.

1.30 i send the message and wait for confirmation it, confirmation comes asyncron and after 1 wait its ok.

1.50 the issue is that the confirmation only comes after the sending wait so it times out and the confirmation comes after the wait for it

network seems not the problem by booth ver 1.10
randomaccessfile seems also not the problem by booth ver 1.15

Is it possible that DoEvents not work in 1.50 ?

'Warte Auf Quittierung mit MS Pause
Sub TC_WaitForQ(MSPause As Long, QId As String)
Dim Result As Boolean
Result = False
Dim Zeit As Long
Zeit = DateTime.Now
'Log("TCPClient.TC_MSG_Quittierung: " & TCPClient.TC_MSG_Quittierung)
Do Until (DateTime.Now - Zeit) > MSPause
DoEvents
If TCPClient.TC_MSG_Quittierung = QId Then
Result = True
Exit
End If
Loop
Log("WAITFORQ Result: " & Result)
Log("WAITFORQ Result: " & TCPClient.TC_MSG_Quittierung & " " & QId)
Return Result
End Sub

Sub TC_AStreams_NewData(Buffer() As Byte)
Dim MSG As String
MSG = BytesToString(Buffer, 0, Buffer.Length, "CP1252")
'Log(MSG)
'//#13+#10 abschneiden
If MSG.IndexOf(TC_LineEnd) > -1 Then
MSG = d.Copy(MSG, 1, MSG.IndexOf(TC_LineEnd))
End If
'Log(MSG)
Dim Header, Wagen, Id, Cmd, Param, Text As String
'//Header|Wagen|Id|Cmd|Param|Text|
Header = TcLib.TC_MSGDecode(MSG, 1)
'Log("Header: " & Header)
Wagen = TcLib.TC_MSGDecode(MSG, 2)
'Log("Wagen: " & Wagen)
Id = TcLib.TC_MSGDecode(MSG, 3)
'Log("Id: " & Id)
Cmd = TcLib.TC_MSGDecode(MSG, 4)
'Log("Cmd: " & Cmd)
Param = TcLib.TC_MSGDecode(MSG, 5)
'Log("Param: " & Param)
Text = d.StringReplaceAll(TcLib.TC_MSGDecode(MSG, 6), "{", Chr(10))
'Log("Text: " & Text)


If Header = "Q" Then
TC_MSG_Quittierung = Header & Id
Log("Quitierung: " & TC_MSG_Quittierung)
Else
MSG = "Unbekannte MSG : " & MSG
ToastMessageShow(MSG, False)
End If
Log(MSG)
End Sub

B4A 130:

D|0000|185000796|DT|Di 24.05.2011 18:50:00||
TC_Spiegel_Platz
TC_Spiegel_Platz
SendenTCP
TC_Spiegel_PlatzTCP 185000708
Sendeversuch 1
Quitierung: Q185000708
Q|0777|185000708|SP|M1||
WAITFORQ Result: true
WAITFORQ Result: Q185000708 Q185000708
L EOM: 5
L SR: 5
I CI: 328
L R_MSG: 333
D|0777|185000708|SP|M1|18:50:01 Spiegel :{M1: (-/-){C1: (-/-){D1: (-/-){E1: (-/-){G2: (-/-){G3: (-/-){J1: (-/-){L4: (-/-){P2: (-/-){S2: (-/-){S3: (-/-){|


B4A 150:

TC_Spiegel_Platz
TC_Spiegel_Platz
SendenTCP
TC_Spiegel_PlatzTCP 185208492
Sendeversuch 1
WAITFORQ Result: false
WAITFORQ Result: Q185147130 Q185208492
TC_Spiegel_Platz
SendenTCP
TC_Spiegel_PlatzTCP 185208492
Sendeversuch 2
WAITFORQ Result: false
WAITFORQ Result: Q185147130 Q185208492
TC_Spiegel_Platz
SendenTCP
TC_Spiegel_PlatzTCP 185208492
Sendeversuch 3
WAITFORQ Result: false
WAITFORQ Result: Q185147130 Q185208492
Quitierung: Q185208492
Q|0777|185208492|SP|M1||
Quitierung: Q185208492
Q|0777|185208492|SP|M1||
Quitierung: Q185208492
Q|0777|185208492|SP|M1||
L EOM: 5
L SR: 5
I CI: 245
L R_MSG: 250
D|0777|185208492|SP|M1|18:52:10 Spiegel :{M1: (-/-){C1: (-/-){D1: (-/-){E1: (-/-){G2: (-/-){G3: (-/-){J1: (-/-){L4: (-/-){P2: (-/-){S2: (-/-){S3: (-/-){|
L EOM: 5
L SR: 5
I CI: 379
L R_MSG: 384
D|0777|185208492|SP|M1|18:52:09 Spiegel :{M1: (-/-){C1: (-/-){D1: (-/-){E1: (-/-){G2: (-/-){G3: (-/-){J1: (-/-){L4: (-/-){P2: (-/-){S2: (-/-){S3: (-/-){|
L EOM: 5
L SR: 5
I CI: 513
L R_MSG: 518
D|0777|185208492|SP|M1|18:52:11 Spiegel :{M1: (-/-){C1: (-/-){D1: (-/-){E1: (-/-){G2: (-/-){G3: (-/-){J1: (-/-){L4: (-/-){P2: (-/-){S2: (-/-){S3: (-/-){|
 

alibaba

Member
Licensed User
Longtime User
I now that i can go around with timer i tested it but it's not a clean solution,
and gives no answer why the _NewData event in 1.50 not fires up when data received how in 1.30 ?

What are the changes from 1.30 to 1.50 there ?

The problem seems not in network randomaccessfile :confused:

1.30

Sending >
Wait and Check
< Confirmation
OK Finish

1.50
Sending >
Wait and Check
Wait and Check
Wait and Check
NOT OK Finish
< Confirmation

No Line of Code changend only compiled with 1.50 or 1.30 :confused:

That's a strange behavior for an Update and produces much Work for doing a Workaround ! :sign0161:
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
DoEvents was not supposed to deal with events that come from different threads as it exposes all kinds of problems. I'm surprised that it worked in the previous version. There was some refactoring of the messages queue handling in v1.50.

Using timer is the correct solution for allowing proper consumption of messages.
The description of DoEvents will be updated to better explain its usage.
 
Top