How to do networking in Squeak?
Lex Spoon
lex at cc.gatech.edu
Tue Feb 3 06:03:02 UTC 2004
Hmm, OldSocket seems to have a bunch of examples to look at. Definitely
look at them; they may not work as written, but they should give you a
good idea of what is going on.
Also, you should learn about workspaces if you haven't already. They
will let you run one command at a time and save the results into
variables. So you can do this:
listener _ Socket newTCP.
listener listenOn: 8080.
And now the "listener" variable holds a socket that is listening. Then
you can do something like this:
connector _ Socket newTCP.
connector connectTo: (NetNameResolver localHostAddress) port: 8080.
And now the sockets are connected and you can do sendData: and
receiveData.
But as Goran mentioned, raw sockets are just the tip of the iceberg. If
there is a particular networking task you'd like to accomplish, you
could probably get the task done faster by working at a higher level.
HTTP and/or XML streams, for example.
-Lex
More information about the Squeak-dev
mailing list
|