[Newbies] simple server?
Michael van der Gulik
mikevdg at gulik.co.nz
Tue Nov 13 08:46:38 UTC 2007
Yes; sorry about that. REPLServer has dependencies on other packages.
If you use the UniversesBrowser from Squeak 3.10, it will load
dependencies automatically for you.
Don McLane wrote:
> Thanks Michael.
> My problem may have become immediately obvious when I tried to load
> REPLServer. I need TCPService. But where do I get that? It's not on
> SqueakMap. Google isn't helpful.
> p.s. I'm not IRC literate yet, but I'll look into that next.
> Michael van der Gulik wrote:
>> Don McLane wrote:
>>> I'm trying to learn to write network objects in squeak. I read the
>>> chapter "Networking Squeak" by Parsia, Kerimbaev, and Spoon, from Mark
>>> Guzdials book. But I wanted to start at a more basic level.
>>> My first attempt is to write the simplest possible server. This server
>>> should wait for a connection, then print the first line sent to it,
>>> finally close. Unfortunately, it gets a "primitive failed" error. I
>>> got the same result on XP and Vista. Here's my code:
>>> | serverSocket connectionSocket |
>>> Socket initializeNetwork.
>>> serverSocket := Socket newTCP.
>>> serverSocket listenOn: 8080.
>>> connectionSocket := serverSocket accept.
>>> Transcript show: (connectionSocket upToAll: String crlf).
>>> connectionSocket close.
>>> serverSocket close.
>>> I found some old code for the PWS and looked around. It makes a
>>> ServerSocket object, but I can't find that class in my image (3.9-7067).
>>> If I do get a server socket to return a connection socket, is there a
>>> way to convert that socket into a SocketStream?
>>> Can anyone get me un-stuck? I've been trying to get past this for a
>>> couple evenings now.
>> Hi Don.
>> You'll be wanting to do:
>> ss := SocketStream on: serverSocket.
>> I would recommend looking at a simple network service. One I can think
>> of is REPLServer, which is a telnet server, but there may be simpler
>> ones out there for e.g. HTTP.
>> Also, if you want faster help, I recommend joining the #squeak IRC channel.
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners