Hi Alejandro,

please comment on what the function will return if there are several
IP interfaces on a machine.

AC> Function GetIPAddress():String;
AC> type
AC>   pu_long = ^u_long;
AC> var
AC>   varTWSAData : TWSAData;
AC>   varPHostEnt : PHostEnt;
AC>   varTInAddr : TInAddr;
AC>   namebuf : Array[0..255] of char;
AC> begin
AC>   If WSAStartup($101,varTWSAData) <> 0 Then
AC>     Result := ''
AC>   Else
AC>   begin
AC>     gethostname(namebuf,sizeof(namebuf));
AC>     varPHostEnt := gethostbyname(namebuf);
AC>     varTInAddr.S_addr := u_long(pu_long(varPHostEnt^.h_addr_list^)^);
AC>     Result := ''+inet_ntoa(varTInAddr);
AC>   End;
AC>   WSACleanup;
AC> end;

tx,
dima


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to