socket synchronization
Andreas.Raab at gmx.de
Andreas.Raab at gmx.de
Wed Nov 20 11:06:37 UTC 2002
> Thinking about it again:
>
> upToAll: delims
> | searchBuffer index |
> searchBuffer _ String new.
> [searchBuffer _ searchBuffer , self inStream contents.
> self resetInStream.
> index _ searchBuffer indexOfSubCollection: delims startingAt: 1.
> index = 0]
> whileTrue: [self receiveData].
>
> receiveData is only called when data is required, so there should be no
> difference between this version and replacing it with receiveDataNoWait.
> If there is data, then the call should return before the timeout
> anyways???
Right. *If* there is data. In an ftp control connection there isn't since
you're waiting for the response to some command. The problem is that
#receiveData loops until the server closes or times out - what it should do (at least
for upToAll:) is to return immediately as soon as data is there so that the
input can be searched for a match. IOW, what happens is something like:
client sends => 'PASV'
client calls #upToAll: CR
client has no available data
client enters #receiveData
<= server sends 'OK', CR
client keeps looping in #receiveData
client keeps looping in #receiveData
...
client times out in #receiveData
client returns to #upToAll:
So for #upToAll: there should be something like "receiveMoreData" which
returns as soon as *anything* has been received instead of looping.
Cheers,
- Andreas
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!
More information about the Squeak-dev
mailing list
|