reading from socket gives 0 bytes

Yanni Jew yanni at rogers.com
Sun Apr 14 20:36:17 UTC 2002


There was a half-second delay in the line above the code you've
noted below. I had added the delay to work around a problem I
had (as explained in the release notes for PostreSQL client).

Up to now, I had thought it was a problem with the Socket code.
Now that I look at it, the Socket code seems perfectly reasonable,
but the #next method needs to be written in a much more robust manner.
I'm thinking that it needs to re-try the read (N times) before
giving up. The delay before the data appears on the socket is unpredictable,
since it depends on the OS and machine configuration. You don't necessarily
want to change the standardDeadline value, since that could cause
unacceptable delays in other places.

Hope that helps. By the way, I've never tried the code under Win2000.

-yanni

P.S. I'm curious what you're doing with PostgreSQL and Squeak.
For the last few months, I've not worked with Squeak/Postgres, but
earlier, I was working on a database backed web "thingy". Now, there's
SWAZOO and SSP, which cover off a few of the things I had in mind.


Kamil Kukura wrote:
> 
> I work with PostgreSQL and here is the piece code of PGConnection>>next
> 
>     (socket waitForDataUntil: Socket standardDeadline)
>         ifFalse: [self error: 'timed out getting data'].
>     lastReadIndex _ socket receiveDataInto: readBuffer
> 
> It happens that #waitForDataUntil: returns true so there should be some
> data ready but lastReadIndex gives 0. I use Windows 2000, Squeak 3.0
> with VM version 3.2 (release build 1). To me it's quite strange behavior
> perhaps in Windows' VM only. Or is it normal?
> 
> --
> Kamil



More information about the Squeak-dev mailing list