[squeak-dev] Socket (was: Re: Winds of change)

Andreas Raab andreas.raab at gmx.de
Sun Feb 8 02:31:49 UTC 2009


Daniel Klein wrote:
> I do notice the SocketStream has a HTTP example, but I don't think 
> SocketStream is for TCP (I could be wrong, but there is no documentation 
> either way).

You are wrong. SocketStream is for TCP.

> I haven't figured it out yet in Squeak. I thought I could do something 
> like this:
> 
> wire := SocketStream openConnectionToHostNamed: 'telnetHostname' port: 23.
> 
> and then use
> 
> wire upToAll:
> 
> and
> 
> wire nextPutAll:
> 
> but this just 'hangs' and I have to alt+. to abandon the process.

No, it works just fine. For example:

   stream := SocketStream openConnectionToHostNamed: 'www.squeak.org' 
port: 80.
   stream nextPutAll: 'GET / HTTP/1.0', String crlf, String crlf.
   stream flush.
   header := stream upToAll: String crlf, String crlf.
   content := stream upToEnd.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list