[Twisted-Python] send_UDP?

Jean-Paul Calderone exarkun at divmod.com
Sun Feb 25 15:08:58 EST 2007

On Sun, 25 Feb 2007 20:52:47 +0100, Sven-Erik Tiberg <sven-erik.tiberg at ltu.se> wrote:
>Just need a small tip, how to send a string by UDP, should I use socket from python or can I use any twisted class.
>Put together a rough code for reciving a string of data from simulink ( matlab ) to a H3D ( Haptic Interactive X3D ) application www.h3d.org
> [snip]
>from twisted.internet.protocol import DatagramProtocol
>from twisted.internet import reactor
>class Recive_UDP_Package(DatagramProtocol):
> def datagramRecived(self, data):
>  recived_vect=data # need to work on this to convert the data string to list element
>  set_a_position()
>  set_speedo()
>reactor.listenUDP(7999, Recived_UDP_Package())

After this port is set up, the Recived_UDP_Package instance will have a
'transport' attribute which you can use to send UDP packets.  For details,



More information about the Twisted-Python mailing list