client/server framework

kris foo at
Fri Feb 2 12:10:26 PST 2007

Alberto wrote:
> There is a client/server framework for D? maybe something like
> quickserver for java.
> I need also a framework for making RPC calls between client and server
> (something like dualrpc in java).
> For rpc I know mango.xml.rpc, that isn't exactly what I need, but..
> mango.xml.rpc is "under construction", someone have tested it? I need it
> for a complex application, it must be stable.
> ps: I could use mango.http.client and mango.http.server, but essentially
> I don't want/need http..
> pps: I can code a VERY simple (I'm not a good programmer) framework  by
> myself, but it will take a lot of time, possibly I prefer code my
> application :P

Mango has a Servlet engine: the http-server is simply a wraper on top. 
There's a few servlet examples in the Mango codebase, showing how to set 
things up, and it's pretty simplistic (no config files).

The servlet engine has been stable for getting close to 3 years now, so 
it might work for you? However, it does not support chunking at this 
time (if that's important to you).

Talking to a servlet from a client is as simple as opening a socket to 
it, and sending the appropriate protocol request. For servlets, the 
protocol generally used is the HTTP GET/POST/HEADER style. That does not 
mean the servlets are HTTP/HTML limited; only that the /path/ specified 
in the request is used to map a request to the appropriate servlet 
implementation. After making the request, the delivery protocol is 
entirely between the client itself and the servlet on the other end :)

You can happily use the HttpClient for talking to the Servlet engine ... 
all it does is set up the (above) HTTP request and set things in motion. 
The reply from the server can be any kind of data/encoding you wish 
(e.g. not HTML). At that point, the data is purely a stream of bits.

Mango works with Phobos and with Ares, via a -version switch. There's 
also a version of the servlet engine that operates with Tango instead. 
In fact, all the high level code in Mango (servlets, http, sax, 
clustering, etc) all work with Tango. The code for this is currently 
located in a seperate area while we figure out where to put it :)

Tango already has HttpClient as part of the network protocol support (in 
tango/net/http). If you're working with phobos, I'd suggest looking at 
Mango. If you're ready to dive into Tango, then we could point you at 
the relevant server additions for that instead?

Good luck!

- Kris

More information about the Digitalmars-d-learn mailing list