[PD] Get IP from Pd + network broadcast

João Pais jmmmpais at gmail.com
Sun Jan 24 13:57:50 CET 2021

Hi, I'm replying to both mails in one:

>> I wanted to check if there are any new methods to get one's own ip 
>> from Pd 
> Are you talking about the local IP address or your public IP address?

I'm trying first to implement this on local networks, so the first. But 
I would like later to also do this for any network connection, where the 
second will be necessary (I know this only from websites such as 

>> I read somewhere that was also for broadcast, but 
>> since it's not working I imagine I read wrong. 
> is indeed the broadcast address. What is not working? 
> Which Pd version? Which network objects? Broadcast works just fine for 
> me with [netsend -u] in Pd 0.51 on Windows 7.
> Note that broadcast/multicast can only be used for local networks. 
> Also, for p2p communication over the internet you need 
> https://en.wikipedia.org/wiki/UDP_hole_punching.

I'll have a closer look, this is new to me. I did made performances with 
data transfer in pd (and max) in the internet some years ago, but 
haven't done this often or sistematically in a while.

> Depends on the kind of subnet. If your netmask is, then
> yes. But networks can be of any size and depending on the size, the
> broadcast address of that network might be a different one. The IP-
> Address in a local network is divided in a network-prefix and host
> part. You see often addresses specified in CIDR notation, for example:
> The '24' means that the first 24 bits of the address
> are the network prefix, and the remaining 8 bits is the host part. For
> getting the broadcast address of a given subnet, you set all bits of
> the host part to 1, which results in x.x.x.255 for a /24 network.

I think I would try to keep it safe and use ipv4 for now.

>> And final question: besides netpd, are there any known public patches 
>> where users from several networks can connect to and send/receive data? 
> Are talking about local networks or the internet?

First local, but later also internet.

> Shameless plug: The next (pre)release of "aoo" will allow sending 
> arbitrary OSC messages over the internet. It has methods for sending 
> messages to individual peers and also "broadcast" messages to all 
> connected peers. Hopefully I manage to release it soon... It's way 
> overdue :-/

That is interesting. But unfortunately I'll also need to use this on 
mobiles, so I'm trying for a vanilla solution.

I've done some tests the last days, and here some more concrete 
information to who might be interested:

- I'm adding networking to my Click Tracker patch 
(http://j.mp/click-tracker), and since it will be used by musicians who 
don't even know what Pd is, it would be comfortable to avoid them search 
for computer details when on a local network.

- there isn't much data to be sent: loading the scores (a text file) to 
all users, and then basically a play/stop switch, velocity, etc.

- The purpose is to work on all OSs and android (the app version is 
based on mobmuplat)

- I've done tests on my local network using 2 computers (W10, Pd 0.51.4, 
wireless) and an android phone with mobmuplat. Sending from 
[oscformat]->[netsend -u -b] to [netreceive -u -b]->[oscparse]. The 
results are:

   - both and work fine in all directions

   - so does communicating with direct IPs (if I end up implementing 
this outside of local networks, I'll need to use this and prepare a 
system to manage users)

   - doesn't work, although that's my subnetmask. Pd's 
console shows the error "a socket operation related to an unavailable 
network" (translated loosely from German)

   - strangely, one of the computers receives all messages 2x. Both when 
it's connected to wireless+lan, or also when only one of these.

   - the phone can send lists such as "list /test", but floats (as both 
float or "/list $1") aren't sent. This isn't a problem when sending from 
the computers.

Any other suggestions/experiences regarding this context?



More information about the Pd-list mailing list