Possible bug in v2.20 concerning sockets ?

Dirk A

Member
Licensed User
Longtime User
Hi ,
Since I've upgraded to v2.20 I've noticed the following problem :
I'm using a socket that connects to my server application . Everything is ok with the connection but the problem is that when I close my server app (so that I'm sure that all sockets should be closed , or errors should be detected) my socket.connected is still true .
I'm using an Asyncstream with the socket and when I send my 'alive sign' no errors are thrown when the server is down.

Befor I upgraded to 2.20 I did not have this problem
thank you

edit : the server is a Delphi app
 
Last edited:

Dirk A

Member
Licensed User
Longtime User
I have reinstalled the v2.0 B4A and reloaded my older backup , here the problem does not occur (note : nothing has changed to the code , it was only compiled using v2.0) so there might be a bug in the 2.20 version
 
Upvote 0

Dirk A

Member
Licensed User
Longtime User
Erel ,
I did not handle the AsyncStreams_Terminated errors(only the AsyncStreams_Error ) , it seems to do the trick ! thanks !
But still , it's strange that the problem did not occur in the 2.0 version...
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is actually related to a fix in AsyncStreams. Previously if the stream was unexpectedly closed then an error would have thrown when you tried to write to AsyncStream. There was a race condition between the Terminated event and the write method. This means that there wasn't a safe way to abort the writing.

It was fixed as a result of a thorough investigation of B4A-Bridge crashes reports.
 
Upvote 0
Top