Re: [twsocket] How can I know the IP address?

2012-12-17 Thread Raymond Kennington

Hi.

I used the function below (from the WWW).

It uses GetHostname in one of the paths, which you might find useful for 
distinguishing the IP addresses.


Raymond
---
Dr. Raymond Kennington

function GetIPAddress(var IPAddress : String) : Boolean;
type
  pu_long = ^u_long;
var
  varTWSAData : TWSAData;
  varPHostEnt : PHostEnt;
  varTInAddr  : TInAddr;
  NameBuf : Array[0..255] of AnsiChar;
begin
  Result := False;

  try
try
  if WSAStartup($101,varTWSAData)  0 then
  begin
 IPAddress := 'Getting IP Address: No Startup'
  end
  else
  begin
GetHostname(NameBuf, SizeOf(NameBuf));

varPHostEnt   := GetHostByName(NameBuf);
varTInAddr.S_addr := u_long(pu_long(varPHostEnt^.h_addr_list^)^);

IPAddress := inet_ntoa(varTInAddr);

Result := True;
  end;
except
  IPAddress := 'Getting IP Address: n/a';
end;
  finally
WSACleanup();
  end;
{$IFDEF TESTING}
ShowMessage('IP Address: ' + IPAddress);
{$ENDIF}
end;



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Did I find a bug in THttpCli? (Beta fix available for download)

2012-12-17 Thread Albert Wiersch
 Arno Garrels wrote:
 
 Well, I should have said not enough spare time to test it very
 carefully Here is a fix that is briefly tested once without proxy
 and once with squid proxy and NTLM authentication in V8 only:
 http://delphi.duodata.de/archive/OverbyteIcsHttpProtV7-V8.zip
 These units are based on latest svn revision.
 Please let us know how it works for you (you have to rename the
 units, replace your local OverbyteIcsHttpProt.pas and rebuild).

Arno,

Thank you!

I've done a quick test myself and the port now seems to be correctly included
in Location and Host.

I will definitely reply back if there is anything to report after further
testing.

Thanks,
Albert Wiersch

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] How can I know the IP address?

2012-12-17 Thread Arno Garrels
David Bridges wrote:
 If I have a wired local area connection and some wireless connection
 how can I know which I'm connected through?  If I can obtain the IP
 address of the adapter I'm connected through I could tell but can't
 determine how to do that.  I tried GetPeerAddr() but it's returning
 error, maybe because I'm asking this question on the server? In any
 case, what is the best way to determine /how/ I am connected from
 within my program?

There is V8 OverbyteIcsSocketUtils.pas that is crossplatform.
In V7 is was OverbyteIcsWinsock2.pas. 

 procedure IcsGetInterfaceList(InterfaceList : TInterfaceList); overload;
 procedure IcsGetInterfaceList(StrList : TStrings); overload;
 function  IcsAddrSameSubNet(const LocalIPv4Addr, SomeIPv4Addr: in_addr) : 
Boolean; overload;
 function  IcsAddrSameSubNet(const LocalIpv4Addr, SomeIPv4Addr : AnsiString) : 
Boolean; overload;
 function  IcsIsIpPrivate(saddr : in_addr): Boolean;

 
 Also, is there anywhere that you can search archives of this list as
 in with a search engine?

http://marc.info/?l=twsocket

-- 
Arno 

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be