ConnectionQueue + SharedQueue question???

Bob Arning arning at charm.net
Tue Oct 24 11:51:58 UTC 2000


John,

One problem that can occur (especially when both ends of the connection are on the same machine) is that the sender can send data and close the connection before the receiving end has time to notice that there is data available. Since #getConnectionOrNil is looking for a socket that is actually connected, it may overlook a connection on which the other end has closed already (but from which data could be read). A modified version that handles this better, #getConnectionOrNilLenient, is in the 2.9a update stream.

Cheers,
Bob

On Mon, 23 Oct 2000 23:46:33 -0500 jchludzinski at worldkey.net wrote:
>I'm using ConnectionQueue and SharedQueue to achieve an exchange of 
>Events between sims.  I place an Event in the SharedQueue (via a 
>'nextPut:').  There is a Process (infinite loop) continuously doing 
>a 'next'.  When an Event is placed on the SharedQueue, a Socket is 
>created (newTCP) to send the Event.  Once the Event has been sent, 
>I print bytesSent.  Afterward I destroy the Socket.
>
>On the receiving side (another Squeak image) I'm using a 
>ConnectionQueue to create a Socket to receive the Event - again 
>another infinite loop (infinitely testing the ConnectionQueue via a 
>'getConnectionOrNil notNil'). I check for bytesReceived.  Once the 
>Event has been received, I print bytesReceived.
>
>My problem is that often I get: bytesSent = 20 and bytesReceived = 
>0 (an Event is placed a 'ByteArray new: 20').  I execute:
>
>ConnectionQueue allInstances do: [ :cq | cq destroy ], in addition 
>to terminating both Processes (infinite loops) - just to make sure.
>
>I added a Delay (forSeconds: 10) before beginning the receiving 
>Process (an infinite loop using ConnectionQueue).  This seems to 
>have eliminated the problem - INITIALLY.  Only to have the problem 
>occur later.





More information about the Squeak-dev mailing list