Socket problems : ConnectionTimedOut
douglas mcpherson
djm1329 at san.rr.com
Fri Mar 17 17:34:58 UTC 2006
Hi all,
I am running latest stable 3.8, and writing an app which must
communicate using several sockets. I am having recurring, yet not
consistent, errors when trying to connect to remote TCP sockets.
The error is in Socket >>connectTo:port: waitForConnectionFor: with
a ConnectionTimedOut exception. I have been trying to track down what
is going on, but don't seem to be making much headway. The problem is
that the timeouts are always set to 45 (seconds), but the so-called
timeout errors occur immediately after trying to connect, without
waiting the for timeout period. In Socket>>waitForConnectionFor: ,
the code which should be performing the waiting is:
Socket >>waitForConnectionFor: timeout ifTimedOut: timeoutBlock
"Wait up until the given deadline for a connection to be
established. Return true if it is established by the deadline, false
if not."
| status deadline |
deadline _ Socket deadlineSecs: timeout.
status _ self primSocketConnectionStatus: socketHandle.
[(status = WaitingForConnection) and: [Time millisecondClockValue <
deadline]]
whileTrue: [
semaphore waitTimeoutMSecs: (deadline - Time millisecondClockValue).
status _ self primSocketConnectionStatus: socketHandle].
status = Connected ifFalse: [^timeoutBlock value]
This method is usually invoked following a
Socket>>primSocket:connectTo:port:. . Since no waiting appears to
occur, it seems that the socket status is not 'WaitingForConnection'
as is expected, and the method returns without waiitng, and with no
connection.
I have been playing with this on both Mac OS X (G4) and Win XP
platforms, and see the same problems. Anybody else? Suggestions? Thanks.
Regards,
Doug
More information about the Squeak-dev
mailing list
|