[Rprotobuf-yada] playing with sockets.

Romain Francois romain.francois at dbmail.com
Tue Dec 1 18:51:14 CET 2009


This is getting clearer how to approach this. With the new dynamic help 
system, R has all the power of a web server.

The code of R web server is in the Rhttpd.c file in the R distribution, 
it handles GET, HEAD and POST methods by calling the hidden 
tools:::httpd function.

With the patch I have proposed on R-devel, plus some hackery of httpd, 
we can get protobuf server over http for free.

We could do something like this :

- send a POST request to the url : 
http://127.0.0.1:12345/RProtoBuf/full.service.name/Method
- the body of the request would be the serialized input of the given 
method, and the length of the message would be contained in the headers 
of the POST request (as Content-Length)
- hack around httpd so that it recognize "RProtoBuf" and send the response


On 11/30/2009 09:56 AM, Romain François wrote:
> Hello,
>
> I've added some code in trunk to start playing with sockets. It is
> absolutely not functional currently, and was more an excuse to learn
> about sockets programming in C.
>
> I have based it on the protocol used by this rpc implementation:
> http://code.google.com/p/protobuf-rpc/ but I am not sure this is the
> best one to use.
>
> The client side, as in "R invokes a remote rpc method" is not so hard I
> think: open a socket, write the input message and read the result
> message back.
>
> The server side is going to be more tricky because I need to understand
> threads on top of sockets.
>
> Romain


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/FtUu : new package : highlight
|- http://tr.im/EAD5 : LondonR slides
`- http://tr.im/BcPw : celebrating R commit #50000



More information about the Rprotobuf-yada mailing list