Getting TCP/IP information.

U

UJ

I can easily get the TCP/IP address of the local machine but I'd also like
to know if the machine is behind a firewall/hub - what the address is that
is being sent over the net.

Is there anyway to get the TCP/IP that is actually being sent out there?

TIA - Jeff.
 
N

Nicholas Paldino [.NET/C# MVP]

Jeff,

No, not through a regular socket connection. You would have to have
this sent to your client/server as part of your message exchange for your
protocol.

Hope this helps.
 
C

Chris Mullins

UJ said:
I can easily get the TCP/IP address of the local machine but I'd also like
to know if the machine is behind a firewall/hub - what the address is that
is being sent over the net.

Is there anyway to get the TCP/IP that is actually being sent out there?

Is this really what you're looking for? Most people asking this tend to be
looking for a way to traverse NAT's and Firewalls in order to make direct
P2P connections for thigs like conferencing, or file transfers.

If this is so, you want to lookup the technologies called ICE and STUN.
Using these provides a solid mechanism for getting direct connections even
for 2 machines that are both behind firewalls and using NAT.

However I don't know of any ICE/STUN implementations in .Net. If you find
one, please let me know!
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

UJ said:
I can easily get the TCP/IP address of the local machine but I'd also like
to know if the machine is behind a firewall/hub - what the address is that
is being sent over the net.

Is there anyway to get the TCP/IP that is actually being sent out there?

You can ask a service out on the internet what IP it sees.

I once wrote this little hack:

public static string MyIp()
{
WebClient wc = new WebClient();
StreamReader sr = new
StreamReader(wc.OpenRead("http://www.myip.dk/"));
string html = sr.ReadToEnd();
return Regex.Matches(html, @"(?:<title>Your IP:
)(\d+\.\d+\.\d+\.\d+)(?:</title>)")[0].Groups[1].Value;
}


Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top