[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] [Q] Any simple example or documentation on NetServe

From: Paolo Bonzini
Subject: Re: [Help-smalltalk] [Q] Any simple example or documentation on NetServer code?
Date: Thu, 26 Oct 2006 19:28:19 +0900
User-agent: Thunderbird (Macintosh/20060909)

Sorry, i got the topic somehow wrong in the other posts. Sorry for
being so noisy. I most should've posted the stuff more as a question
of mine than an answer :)
No problem. I guess Sungjin can do the same as you did -- browse the code for NetServer -- and rewrite the code with the NetServer architecture (which is a set of abstract classes that take care themselves of the forking), while still starting from somewhere.

You have to subclass NetServer and NetSession. NetServer listens on a socket and creates NetSessions; NetSession parses requests and passes them back to NetServer. (Note that the request is an arbitrary object, so you can pass in your case for example an association like socket->data and do "request key nextPutAll: request value")

Then, you implement your server by overriding this methods:

- in the EchoServer, #newSession (answering "EchoSession new" in your case) and #respondTo: (which takes the request association and answers as I outlined above)

- in the EchoSession, #next (which might be as easy as "self socket->self socket nextHunk")

Note that examples and documentation are what is badly needed. Sending them will never hurt.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]