On Sat, Aug 30, 2014 at 09:19:49AM +0200, stepharo wrote: > Hi holger Hi!
thanks for the answer. > I got confused. sorry about that. > There is a problem with next: not raising error? Classic ReadStream in Pharo3.0 #[] readStream next: 2 => #[] SocketStream: 1.) Start something that listens to 12345 $ nc -l -p 12345 2.) In Pharo do | conn | conn := (SocketStream openConnectionToHostNamed: 'localhost' port: 12345) binary; noTimeout; yourself. [ (conn next: 4) inspect. ] on: ConnectionClosed do: [:e | "Never called" self halt ]. 3.) CTRL+C the netcat process.. 4.) In Pharo an inspector on an ByteArray is coming up. The ConnectionClosed signal is raised but swallowed by the SocketStream code. I don't know how realistic it is but I would appreciate if 1.) #[] readStream next: 4. Could raise an Error that one can not consume four bytes/elements. 2.) I understand that not raising "ConnectionClosed" is to allow a partial read from the socket. What is done in GNU Smalltalk is to at least signal an EndOfStream notificaton. So the socket code could read like: | conn | conn := (SocketStream openConnectionToHostNamed: 'localhost' port: 12345) binary; noTimeout; yourself. [ (conn next: 4) inspect. ] on: EndOfStream do: [:e | self handleClosing ]. is this more clear? holger