Funkcia na zistenie vlastnej IP adresy.

uses winsock; 
 
function my_ip_address:longint; 
const 
  bufsize=255; 
var 
  buf: pointer; 
  RemoteHost : PHostEnt; (* No, don't free it! *) 
 
begin 
  buf:=NIL; 
  try 
   getmem(buf,bufsize); 
   winsock.gethostname(buf,bufsize);  (* this one maybe without domain *) 
   RemoteHost:=Winsock.GetHostByName(buf); 
   if RemoteHost=NIL then 
     my_ip_address:=winsock.htonl($07000001)  (* 127.0.0.1 *) 
   else 
     my_ip_address:=longint(pointer(RemoteHost^.h_addr_list^)^); 
  finally 
   if buf<>NIL then  freemem(buf,bufsize); 
  end; 
  result:=winsock.ntohl(result); 
end;