Hello.  Well, ultimately, here is my solution.

This appears to work 99.9% of the time, maybe 100%.  There was one failure,
but not sure if it was a related problem... ;)

Oddly, turning on the TWSocket MultiThreaded property tends to alleviate the
majority of symptoms.  As I understand, the only major difference when
MultiThreaded is on is that the ClientSocket utilizes its own messaging
interface?  Right?

As for the issue I mentioned in the last email I posted, I solved the
sequencing issue this way.  Previously, I had a global "send packet"
routine, wrapped in a Critical Section for thread safety.  I use a single
Global send routine so that I can gather statistics in one place (total
bytes sent, total packets sent, total session bytes, etc).  Since the
MultiThreaded message loop was picking up responses before I was prepared to
receive them, I created an additional couple of global routines.  One is a
global "post packet" routine, which processes the packet, but uses
PutDataInSendBuffer to prepare and que up the outbound traffic (framing,
encryption, etc), instead of sending it immediately.  Then, when I am
prepared to handle any related responses, I call a new global "Send Buffer"
procedure, that simply issues a 0 byte Send on the ClientSocket to begin
sending the que'd data.  I then changed the sequence order sensitive
handshaking routines to use the PostPacket / SendBuffer routines instead.

This approach has appeared to fix the issue sufficiently.  I am perplexed as
to the nature of the issue itself, but for now, this will suffice.  The
scenario of both programs (client and server) being on one system is never
going to occur during a "live production" environment.  Solving this issue
is really only relevant for development, testing and demonstration purposes.

None-the-less, I am concerned that the surfacing of this issue might reflect
some deeper logic flaw in the system as a whole.  

Does this solution sound appropriate?  It appears to work fine.  And does
the problem issue sound like it should occur at all?  Or does it sound like
I have done something really BAD?  I still can't get over the fact that it
works fine and never occurs on the proverbial "my machine"... :)

Thanks...

Hoby


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to