|
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 1.5.0.7 (Macintosh/20060909) |
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.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 :)
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.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |