I create an instance of ConnectionQueue to listen on a specified portNumber (hardwiring the queueLength to be 4). When I try to connect to this instance
(using an instance of Socket:
socket _ Socket newTCP. socket connectTo: (NetNameResolver localHostAddress) port: 54321. socket waitForConnectionUntil: Socket standardDeadline.)
nothing shows up in 'connection' (an instance of OrderedCollection). As a consequence, 'getConnectionOrNil' returns 'nil'.
Obviously I'm doing something wrong, any suggestions???
---John
I create an instance of ConnectionQueue to listen on a specified portNumber (hardwiring the queueLength to be 4). When I try to connect to this instance
(using an instance of Socket:
socket _ Socket newTCP. socket connectTo: (NetNameResolver localHostAddress) port: 54321. socket waitForConnectionUntil: Socket standardDeadline.)
nothing shows up in 'connection' (an instance of OrderedCollection). As a consequence, 'getConnectionOrNil' returns 'nil'.
Obviously I'm doing something wrong, any suggestions???
---John
John,
It could be that you still have an old ConnectionQueue hanging around somewhere that is still listening on that port (and consequently grabbing the connections instead of the expected ConnectionQueue getting them).
Evaluating the following code in a workspace yields an inspector on a dictionary with a client socket, a server socket, and the queue...in order to have this code work twice in a row, you may need to destroy the queue between evaluations. Both sockets should be connected.
--- | connectionQueue serverSocket clientSocket | connectionQueue _ ConnectionQueue portNumber: 54323 queueLength: 4. clientSocket _ Socket newTCP. clientSocket connectTo: (NetNameResolver localHostAddress) port: 54323. clientSocket waitForConnectionUntil: Socket standardDeadline. serverSocket _ connectionQueue getConnectionOrNil. Dictionary new at: 'client' put: clientSocket; at: 'server' put: serverSocket; at: 'queue' put: connectionQueue; inspect. ---
Hope that helps, Stephen
squeak-dev@lists.squeakfoundation.org