Note that large UDP packets can be unreliable in general, unless you
can make assumptions about the network between client and server.
Many UDP protocols limit themselves to 512-byte packets for this
reason. http://stackoverflow.com/questions/1098897/what-is-the-largest-safe-udp-packet-size-on-the-internet
Also, it's generally a bad idea to use pickled objects in a network
protocol - decoding pickled objects is essentially eval()ing arbitrary
code, so it's not safe to receive pickled objects from untrusted
sources.
-Ben
I wouldn't say threading is discouraged with tornado. If you've got
something that works in a separate thread, there's nothing wrong with
continuing to use that with tornado. Just remember to use
IOLoop.instance().add_callback() for the handoff from the UDP server
thread to the tornado thread.
> Are there iostream type libraries which provide callback based mechanism. I
> cannot use the polling method to see if udp side has sent some data. My
> server serves a real time application and I am using comet programming to do
> this. Any updates from udp side must be sent back to client in real time and
> to do this I need to raise an event on tornado web server side.
>
I don't know of any IOStream-like UDP modules for tornado, but it
shouldn't be too hard to write one. You may not even need much of a
library since there's no buffering (just use IOLoop.add_handler
directly), but given the problems you're seeing with IOStream there
may be some tricks around reassembling fragmented packets.
-Ben
-Ben
On Sat, Nov 20, 2010 at 12:26 AM, Imran Farooq