Is this socket code correct?

Juan Cires Martinez jcm at mat.upm.es
Wed Nov 17 12:13:15 UTC 1999


I am writing some code to access a socket like this:

  (socket waitForDataUntil: Socket standardDeadline) ifFalse: 
      [self error: 'Timeout reading reply'].
  buffer _ ByteArray new: 10000.
  read _ socket receiveDataInto: buffer.
  read < 4 ifTrue:
      [self error: 'Too few data read'].

Sometimes I get the 'Too few data read' with read = 0.  It seems that
waitForDataUntil: is returning true, but receiveDataInto: is not reading
the data?  Any ideas?

Thanks, Juan.





More information about the Squeak-dev mailing list