471,338 Members | 1,304 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

Is local IP Addresses viewable to remote IP Address?

I have an issue where I have a remote IP Address, and I need to discover the
local network interface IP Address which is viewable to the remote IP Address
(for UPnP document purposes). For example, if I have the remote IP Address
10.0.0.4, and I know all of the local IP Addresses:

127.0.0.1
10.0.0.5
10.1.0.20
192.168.0.5
157.54.185.126

How can I determine which of these IP addresses, without connecting to the
remote machine, that if broadcast over that network interface, the remote
device could see the broadcast and also connect to the local machine at that
IP address. I was looking at some properties in the NetworkInterface class
and stuff, but nothing was obvious to me. I hope I am explaining the problem
well enough.

Thanks

Jun 27 '08 #1
1 2238
On Wed, 04 Jun 2008 18:59:02 -0700, Agendum
<Ag*****@discussions.microsoft.comwrote:
[...]
How can I determine which of these IP addresses, without connecting to
the
remote machine, that if broadcast over that network interface, the remote
device could see the broadcast and also connect to the local machine at
that
IP address.
Well, given your remote IP address, you should be able to apply your local
subnet mask to the remote address and each of your local addresses, and if
they result is equal then those addresses are on the same subnet.

But, you really shouldn't need to do this. Just broadcast to
IPAddress.Any, and assuming the remote machine is reachable, it will
receive the broadcast and can use the origin IP address to determine how
to connect back. There should be no reason for your local process to know
or care what the configured IP address is.

Pete
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Tom | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.