ConnectionQueue + SharedQueue question???

jchludzinski at worldkey.net jchludzinski at worldkey.net
Tue Oct 24 19:47:18 UTC 2000


Bob Arning wrote:

>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.

Bob,

I tried downloading 2.9a and using #getConnectionOrNilLenient - to 
no avail: 


bar _ ByteArray new: 100.
[true]
	whileTrue: 
	[ss _ cq getConnectionOrNilLenient.
	ss notNil
		ifTrue: 
		[bytesReceived _ ss receiveDataInto: bar.
		...
		Transcript cr; show: 'receiving...', bytesReceived 
printString.
		ss closeAndDestroy]



So, I tried placing a Delay before the statement that destroys the 
Socket doing the sending:


osProcessToSocket
	valuesDo: 
	[:w | 
	socket _ Socket newTCP.
	socket connectTo: w ip port: w port.
	socket waitForConnectionUntil: Socket standardDeadline.
	bytesSent _ socket sendData: bar.
	Transcript cr; show: 'sending ....', bytesSent printString.
	(Delay forSeconds: 2) wait.
	socket closeAndDestroy].



I still get bytesReceived = 0 (and sometimes I receive nothing - 
the receiving side - using the ConnectionQueue doesn't acknowledge 
that anything has been sent. I can't explain it!

---John







More information about the Squeak-dev mailing list