<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">[netreceive] reports the source address for received data only
for TCP connections, but not for UDP</pre>
      </blockquote>
      [netreceive -u -f] works just fine for me on Pd 0.51 ;-)</p>
    <p>Christof<br>
    </p>
    <div class="moz-cite-prefix">On 22.01.2021 22:52, Roman Haefeli
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:bce827509cc0d851500bcbe3c8e365c4872b2bdb.camel@gmail.com">
      <pre class="moz-quote-pre" wrap="">Hi João


On Fri, 2021-01-22 at 19:41 +0100, João Pais wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">I wanted to check if there are any new methods to get one's own ip
from Pd - that is, so that a user doesn't go check the system
settings.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
I need that, too, and I can't wrap my head around figuring out how to
do it. Using a [shell]-like solution would require different scripts
for each platform. Also, "knowing" the IP address is not that trivial:
A computer might have many physical network interfaces (ethernet and
wlan) and a localhost interface and even has more when hosting virtual
machines and VPN is configured, etc. I count 10 addresses on my laptop.
So, which is the one you're interested in?

Usually, it's the other party (that you're connecting to) that knows.
For a specific connection, the other party knows the address that is
interesting in the context of that particular connection. In Pd
vanilla, [netreceive] reports the source address for received data only
for TCP connections, but not for UDP. iemnet's [udpreceive] will tell
you the sender, though.

There is no deterministic way to define your own address. Depending on
the destination, packets might be routed differently and thus the
source address will be different. If you know the destination address,
you could parse the routing table and deduce the (your) source address
from it.


</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">It would be necessary for all windows, macos and linux. Older
messages talk 
about using [shell] in unix systems, and some hack with a batch file
in 
windows. If this is still the current method, how would one activate

batch file in windows from inside pd?


As my knowledge of network isn't that good, just to check: to send a 
broadcast message for all peers in the same network, is the correct
IP 
e.g. xxx.xxx.xxx.255?
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
Depends on the kind of subnet. If your netmask is 255.255.255.0, 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:
192.168.50.244/24. 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.

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap=""> I read somewhere that 255.255.255.255 was also for 
broadcast, but since it's not working I imagine I read wrong.
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
It's the broadcast address of the 0.0.0.0/0 subnet, a.k.a the whole
IPv4 internet. However, routers do not pass broadcast message from
local network to the internet. But at my home, I can send messages to
all my devices using this address.

Note: it works only with shoot-and-forget protocols like UDP, but not
with connection-aware protocols like TCP.

Also, I'm not sure if all routers pass on such messages.
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">
Resuming: to send a broadcast message in the network, it's necessary
to 
know the first 3 parts of one's IP?
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
In my experience not. Just use 255.255.255.255

Roman
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
<a class="moz-txt-link-abbreviated" href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list
UNSUBSCRIBE and account-management -> <a class="moz-txt-link-freetext" href="https://lists.puredata.info/listinfo/pd-list">https://lists.puredata.info/listinfo/pd-list</a>
</pre>
    </blockquote>
  </body>
</html>