Click here to Skip to main content
15,920,633 members
Home / Discussions / C#
   

C#

 
Questionhow to get public ip Pin
xolla18-Jan-07 10:40
xolla18-Jan-07 10:40 
AnswerRe: how to get public ip Pin
Guffa18-Jan-07 11:02
Guffa18-Jan-07 11:02 
GeneralRe: how to get public ip Pin
xolla18-Jan-07 11:08
xolla18-Jan-07 11:08 
GeneralRe: how to get public ip Pin
swjam18-Jan-07 11:32
swjam18-Jan-07 11:32 
GeneralRe: how to get public ip Pin
xolla18-Jan-07 11:56
xolla18-Jan-07 11:56 
AnswerRe: how to get public ip Pin
Guffa18-Jan-07 11:50
Guffa18-Jan-07 11:50 
GeneralRe: how to get public ip Pin
xolla18-Jan-07 12:08
xolla18-Jan-07 12:08 
GeneralRe: how to get public ip Pin
Dave Kreskowiak18-Jan-07 17:51
mveDave Kreskowiak18-Jan-07 17:51 
You're not understanding. The public IP isn't available to you with an easy API call or something. The address you get for the client's name depends entirely on using the CORRECT name and the viewpoint of the name service resolving that name.

For example, one of your machines, call it SERVER1, has an IP address of 192.169.0.10. It sits behind a NAT and firewall, completely shielded from the Internet. Your ISP assigns you a DNS name, which your server knows NOTHING about and can't get!!, possibly something like user192834.city.state.us.comcast.net. Which name are you going to use??

Keep in mind that your can only get the machines local name, not it's ISP name. Now, if you ask the name service inside your local network what the address of SERVER1, you'll get 192.168.0.10. If you ask the ISP's name service what that address is, you'll get a failure because it doesn't know anything about SERVER1. The reverse is also true.

Even the client has the same problem. It can't possibly know it's public address without asking a specialized web application out on the Internet. This application examines an HTTP request comming from the machine to get the information built up in the request IP headers as the request is passed from your machine to your router and so on through your ISP. It then uses that information to tell you what your public IP is.



Dave Kreskowiak
Microsoft MVP - Visual Basic


GeneralRe: how to get public ip Pin
Guffa18-Jan-07 19:20
Guffa18-Jan-07 19:20 
GeneralRe: how to get public ip Pin
Muammar©19-Jan-07 9:35
Muammar©19-Jan-07 9:35 
General[OT] Pin
Guffa19-Jan-07 9:48
Guffa19-Jan-07 9:48 
Question2 Pop3 Questions (RFC related "I guess!!") Pin
Muammar©18-Jan-07 9:59
Muammar©18-Jan-07 9:59 
AnswerRe: 2 Pop3 Questions (RFC related "I guess!!") Pin
Ravi Bhavnani18-Jan-07 10:03
professionalRavi Bhavnani18-Jan-07 10:03 
GeneralRe: 2 Pop3 Questions (RFC related "I guess!!") Pin
Muammar©18-Jan-07 10:20
Muammar©18-Jan-07 10:20 
QuestionProgress Bar Pin
Civic0618-Jan-07 9:44
Civic0618-Jan-07 9:44 
AnswerRe: Progress Bar Pin
Ravi Bhavnani18-Jan-07 9:53
professionalRavi Bhavnani18-Jan-07 9:53 
AnswerRe: Progress Bar Pin
Muammar©18-Jan-07 10:12
Muammar©18-Jan-07 10:12 
QuestionFormat Disk Drive Programmatically Pin
StCroixSkipper18-Jan-07 9:29
StCroixSkipper18-Jan-07 9:29 
AnswerRe: Format Disk Drive Programmatically Pin
Ravi Bhavnani18-Jan-07 10:00
professionalRavi Bhavnani18-Jan-07 10:00 
AnswerRe: Format Disk Drive Programmatically Pin
Muammar©18-Jan-07 10:14
Muammar©18-Jan-07 10:14 
GeneralRe: Format Disk Drive Programmatically Pin
ednrgc19-Jan-07 2:14
ednrgc19-Jan-07 2:14 
GeneralRe: Format Disk Drive Programmatically Pin
Muammar©19-Jan-07 9:32
Muammar©19-Jan-07 9:32 
Questionhow to play video from stream ? Pin
hdv21218-Jan-07 9:15
hdv21218-Jan-07 9:15 
QuestionEmbed an application inside a window form Pin
erbeh18-Jan-07 9:01
erbeh18-Jan-07 9:01 
AnswerRe: Embed an application inside a window form Pin
Abisodun18-Jan-07 9:17
Abisodun18-Jan-07 9:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.