[PD] create/access udp sockets from within pd

Matthias Blau blau_m at web.de
Thu Feb 28 14:57:00 CET 2013

Hi list,

is there a way in pd to send/receive udp packets via sockets?

The problem at hand is to control an Outline ET250-3D turntable from 
within pd. This turntable can be controlled via udp, which works in 
principle by using mrpeach's udpsend. Unfortunately, the table responds 
to a different port every time a udp packet is sent to it, which means 
that udpreceive and friends will not receive the answer, as they listen 
to pre-defined ports.

One can however communicate via sockets, i.e. in python, the solution is:

from socket import *

ServerIP = 'xx.xx.xx.xx'
Port = 6667
data = bytearray([4, 0, 0, 0]) # command to query table position

client_socket = socket(AF_INET, SOCK_DGRAM)

client_socket.sendto(data, (ServerIP, Port))
recv_data, addr = client_socket.recvfrom(2048)
recv_data= [elem.encode("hex") for elem in recv_data]

Is this possible in pd as well? Or, as an alternative, how would one use 
a python function from within pd to accomplish this?


More information about the Pd-list mailing list