Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Re: Delphi 2005 Personal and Indy 10.0.75: Indy don't work!!!
| Subject: | Re: Delphi 2005 Personal and Indy 10.0.75: Indy don't work!!! |
| Posted by: | "Jamie Dale" (j.da..@turboz.net) |
| Date: | Tue, 6 Jun 2006 02:44:03 |
>> Yes, the IP is checked via an external website using IdHTTP component.
>
> That is not what I asked you. Just checking an external site is NOT a
> guarantee that you will be getting the correct IP on the correct network
> adapter. If there are multiple adapters installed, you need to find which
> adapter is actually connected to the Internet connection, and then ignore
> all of the others. All requests to the external site need to be made to
> go
> through that 1 adapter only to ensure the accuracy of the reported IP.
> Since you are not doing that, you are likely getting different responses.
> That would explain the IP changing when you don't expect it to.
Basically, I have 2 PCs. 1 connected to web: 1 modem, 1 lan socket (which
PC2 shares internet through crossover cable)
Modem is the internet connection. Windows is setup on both machines to share
that connection so IdHTTP should automatically communicate through this
correct?
I do not have any other internet NIC's (EG DSL adapter) - just local network
NIC.
> Trouble or not, you should be doing that. If you don't want to do it
> programmably, then provide a popup window for the user to specify which
> adapter is the one used for Internet connection, and then remember that
> adapter each time your program is restarted.
Yes I understand what you are saying, but if my internet is only connected
via the modem and there are no other internet connections, then as long as
IdHTTP connects to the target website it should not matter should it? - The
target website will report the IP address where the request came from - my
ONLY internet connection/modem/adapter..
>> IdHTTP1.Response.ExtraHeaders.Add('Turboz IP Checker; Contact:
> dale_jamie@yahoo.com');
>
> Why are you doing that? The Response is cleared when Get() is called. If
> you are trying to transmit values to the server, then you have to use the
> Request property instead.
Doh! - My mistake - thanks for that!
>> Response := IdHTTP1.Get('http://checkip.dyndns.org');
>
> If there are multiple network adapters installed, you should be setting
> the
> TIdHTTP's BoundIP property before calling Get(), so that the external
> server
> is reached on the correct connection. For example, in my own IP Update
> program, I use GetAdaptersInfo() to get all available network adapters and
> their current IP addresses. This way, my updated is not effected by
> dynamic
> IPs on my LAN that are assigned by DHCP. I can then look for the adapter
> that belongs to my Internet connection, and set the BoundIP accordingly
> when
> calling Get().
I'll look into it - cheers
>
>> //Response is in HTML format:
>
> If you use a different IP lookup service, such as
> http://iplookup.flashfxp.com, then you won't have to parse any HTML at
> all.
Cool - Just what I needed - Thanks
>
>> //If we find the word 'Updated' in the response string
>
> I don't know about the particular DynDNS service that you use
Freedns - http://freedns.afraid.org
> DynDNS.org sends a 200 HTTP reply if the IP was updated successfully, so
> there is no need to parse the response HTML at all.
Only reason I do that is so that my program confirms the server was updated
with the that was sent.
> You already know
> which specific IP address you are broadcasting to the service, so you
> don't
> need to validate it in the service's response.
Yeah thats fair comment and a damn good point. I'll scrap that....
Hey, you didn't pick any major faults in my code/style yet - are you feeling
ok Remy? :-P