<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi Roman,<br>
<br>
I'm not sure but may be these two croos-platform apps will help sending and analyzing received packets:<br>
<br>
<a moz-do-not-send="true" href="https://packetsender.com/">https://packetsender.com/</a><br>
<br>
<a moz-do-not-send="true" href="https://www.wireshark.org/">https://www.wireshark.org/</a><br>
<br>
Salutti,<br>
Lucarda.<br>
<br>
</p>
<pre class="moz-signature" cols="72">Mensaje telepatico asistido por maquinas.</pre>
<div class="moz-cite-prefix">On 12/16/2017 9:41 PM, Roman Haefeli wrote:<br>
</div>
<blockquote type="cite" cite="mid:1513471298.2125.31.camel@gmail.com">
<pre wrap="">
On Sam, 2017-12-16 at 21:26 +0100, Jack wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Your router has a public and local IP. So, i guess your local machine
has only a local IP. Then, your local machine need to pass through
your
router to access remote server. Your router has NAT rules to know
which
local machine to route the content from the remote server.
I don't really understand what exactly you are looking for
</pre>
</blockquote>
<pre wrap="">
Sorry for not being more clear. I try to rephrase. I like to know what
local IP address a [tcpclient] or [udpclient] connection is using. So,
if my wifi interface is configured to 192.168.1.50 and this interface
is used for communicating to the outside world, how can I get that IP
from within Pd? Your suggestions may work by using [shell], but still
they show all kinds of interfaces and IP addresses and its not trivial
to determine the one that is used to talk to the default gateway (or by
specific connection). 

I would like to implement a technique called UDP hole punching[1] in
Pd. Before two clients talk to each other directly, they exchange some
information by talking to a server with a public IP address that acts
as a man-in-the-middle. As a result, the clients know the public IP
address and the bind port of their peer. This works well so far, even
in my patch. However, if both clients are in the same local network,
they can't establish a connection because they try to connect to the
public IP address of their own router. So, in order to overcome this
limitation, my idea was to check if my router's public IP address is
the same as the one of my peer. If they are, it means both clients are
part of the same local network. In that case, they would use the public
server to exchange each other's local IP addresses. However,
[tcpclient] seems to have no notion of the local IP address of an
established connection. So the patch actually doesn't know what IP
address it is using and thus cannot tell its peer.

Using [shell] and a script based on 'ip addr show' seems tedious and
not very reliable, considering the information needed is part of every
packet sent and received by [tcpclient]. 

If there's no easy way, I might turn that into a feature request for
iemnet's [udpclient] and [tcpclient] to print the src IP address and
src port on the status outlet. Does that make sense?


Roman


[1] <a class="moz-txt-link-freetext" href="https://en.wikipedia.org/wiki/UDP_hole_punching">https://en.wikipedia.org/wiki/UDP_hole_punching</a>


</pre>
<blockquote type="cite">
<pre wrap="">, but here
some possible answer (on linux) :

to get your ip address (local)
$ ip addr
to get the IP address (local) of the router :
$ ip route
to get the public address of the router :
$ curl -s <a class="moz-txt-link-freetext" href="http://whatismyip.akamai.com/">http://whatismyip.akamai.com/</a>
or
$ netcat -w 5 4.ifcfg.me 23
or
$ nc -w 5 4.ifcfg.me 23

There is also other command lines (ifconfig (instead of ip addr),
route
-n (instead ip route), etc.).
++

Jack



Le 16/12/2017 à 17:35, Roman Haefeli a écrit :
</pre>
<blockquote type="cite">
<pre wrap="">
Hey all

Is there a simple cross-platform way for a patch to know the main
IP
address of the local machine? Assume the patch is connected to a
remote
server and is able to request its public IP address. What I like to
find out is if the local patch is communicating through NAT or
directly
to the remote server. 

An incoming IP packet from the remote server would contain that
information in the destination IP address field of the IP header,
but
the network objects I'm using ([tcpclient] and [udpclient]) don't
expose that information. 

Maybe there are other ways?

Roman



_______________________________________________
<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/l">https://lists.puredata.info/l</a>
istinfo/pd-list

</pre>
</blockquote>
<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/lis">https://lists.puredata.info/lis</a>
tinfo/pd-list</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<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>
</blockquote>
<br>
</body>
</html>