Hello.
I’m using a helper app (regular console app) to talk with the main app. When the helper finds results, it reports them using an IPCSocket.
However, I’ve found common situations where the buffer gets too full; the main app receiving data hangs and the helper, unaware of this, continues to send data.
So, I’ve written this code whenever I need to send a result:
do
if Search.Socket.BytesLeftToSend>20000 then 'The socket is “too full”.
System.DebugLog "Delaying result sending…"
app.DoEvents 'Allow bytes to be sent
Else
Exit 'Less or equal than 20000 bytes left to send; can send further
end if
loop
Search.Socket.Write chr(0)+"rslt"+What+if(Value=nil,"",Value.NativePath)+chr(4)+SearchID.ToString+chr(1) 'Message to send
However, I don’t know what is the best value to replace 20000. I guess the amount of RAM is to be taken into account, but what else? And how do we calculate this?