+ >>> from pymin import dispatcher
+ >>> class Root(dispatcher.Handler):
+ @handler('Test command.')
+ def test(self, *args):
+ print 'test:', args
+ >>> PyminDaemon(Root(), ('', 9999)).run()
+
+ The daemon then will be listening to messages to UDP port 9999. Messages
+ will be dispatcher throgh the pymin.dispatcher mechanism. If all goes ok,
+ an OK response is sent. If there was a problem, an ERROR response is sent.
+
+ The general syntax of responses is::
+
+ (OK|ERROR) LENGTH
+ CSV MESSAGE
+
+ So, first is a response code (OK or ERROR), then it comes the length of
+ the CSV MESSAGE (the bufer needed to receive the rest of the message).
+
+ CSV MESSAGE is the body of the response, which it could be void (if lenght
+ is 0), a simple string (a CVS with only one column and row), a single row
+ or a full "table" (a CSV with multiple rows and columns).
+
+ There are 2 kind of errors considered "normal": dispatcher.Error and
+ formencode.Invalid. In general, response bodies of errors are simple
+ strings, except, for example, for formencode.Invalid errors where an
+ error_dict is provided. In that case the error is a "table", where the
+ first colunm is the name of an invalid argument, and the second is the
+ description of the error for that argument. Any other kind of exception
+ raised by the handlers will return an ERROR response with the description
+ "Internal server error".
+
+ All messages (requests and responses) should be UTF-8 encoded and the CVS
+ responses are formated in "Excel" format, as known by the csv module.