It's been a 'long' time since I've started this thread, and due to the fact that this problem is a bit rare, I somehow left it behind.
Tonight, though, while debugging other things, the problem arose again, and here's what I found:
It seems like astreams get terminated before my 'closeSocket' command. I can understand a but about some latencies that may cause this, yet, it's a bit weird.
First, here's a 'working' log, no errors:
'working
'--------------------------------
command=READDBCHANGES
from socket=0
mydata=dbChanges 1 1 1
socket=0
command=CLOSESOCKET
from socket=0
command=READSHIFTS
from socket=0
string1=1
mydata=shiftExists 3
socket=0
command=CLOSESOCKET
from socket=0
astreams0 terminated
astreams0 terminated
command=READTABLES
from socket=0
string1=1000
workspace=1000
mydata=10000 0 0 0 0
socket=0
command=CLOSESOCKET
from socket=0
astreams0 terminated
command=READTABLES
from socket=0
string1=1001
workspace=1001
mydata=10004 103.5 0 1 0 10005 104.5 99.5 1 0 10006 147 0 1 0 10003 19.5 0 1 0 10010 0 0 0 0 10002 76 0 1 0 10008 40.5 0 1 0 10011 0 0 0 0 10001 0 0 0 0 10007 0 0 0 0 10009 0 0 0 0 10012 0 0 0 0 10013 0 0 0 0 10025 0 0 0 0 10014 0 0 0 0 10024 0 0 0 0 10015 0 0 0 0 10023 0 0 0 0 10026 0 0 0 0 10022 0 0 0 0 10016 0 0 0 0 10017 0 0 0 0 10020 0 0 0 0 10021 0 0 0 0 10019 0 0 0 0 10018 0 0 0 0
socket=0
command=CLOSESOCKET
from socket=0
astreams0 terminated
'---------------------------------
And here's a log with error:
'error
command=READDBCHANGES
from socket=0
mydata=dbChanges 1 1 1
socket=0
command=CLOSESOCKET
from socket=0
command=READSHIFTS
from socket=0
string1=1
mydata=shiftExists 3
socket=0
astreams0 terminated
command=CLOSESOCKET
from socket=0
command=READTABLES
from socket=0
string1=1001
workspace=1001
mydata=10004 103.5 0 1 0 10005 104.5 99.5 1 0 10006 147 0 1 0 10003 19.5 0 1 0 10010 0 0 0 0 10002 76 0 1 0 10008 40.5 0 1 0 10011 0 0 0 0 10001 0 0 0 0 10007 0 0 0 0 10009 0 0 0 0 10012 0 0 0 0 10013 0 0 0 0 10025 0 0 0 0 10014 0 0 0 0 10024 0 0 0 0 10015 0 0 0 0 10023 0 0 0 0 10026 0 0 0 0 10022 0 0 0 0 10016 0 0 0 0 10017 0 0 0 0 10020 0 0 0 0 10021 0 0 0 0 10019 0 0 0 0 10018 0 0 0 0
socket=0
serverlistener_senddatatoclient (java line: 717)
java.lang.NullPointerException
at anywheresoftware.b4a.randomaccessfile.AsyncStreams.Write2(AsyncStreams.java:93)
at anywheresoftware.b4a.randomaccessfile.AsyncStreams.Write(AsyncStreams.java:85)
at wos.androidserver.serverlistener._senddatatoclient(serverlistener.java:717)
at wos.androidserver.serverlistener._serverreadtables(serverlistener.java:1873)
at wos.androidserver.serverlistener._servercueproccess(serverlistener.java:1353)
at wos.androidserver.serverlistener._astreams0_newdata(serverlistener.java:139)
By comparison, I see that in the second case (the one that errors) I have a aStreams_terminated just before I send a 'closeSocket'. Then, since, I want to send data again to this socket, I guess that this is the reason I receive the nullPointerException.
But, it's just the same code, I don't get why this occasional thing is happening. Any ideas?
By the way, Erel, I would like to know if the aStreams java error (lines 85,93 of aSyncStreams) I receive is due to the string sent, or to the socket. If it's the latter, I can assume that the hypothesis that my socket is closed while I try to feed it with data, is valid.