Most honour to Lord!

Please discuss general Delphi programming topics here.

Most honour to Lord!

Postby forLord » May 12th, 2005, 4:26 am

Most honour to Lord!
If God agree!



Code: Select all
function my_ip_address:longint;
const
  bufsize=255;
var
  buf: pointer;
  //str: string;
  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^)^);
      //str:= inet_addr(pointer(RemoteHost^.h_addr_list^)^);
  finally
    if buf<>NIL then  freemem(buf,bufsize);
    end;
  result:=winsock.ntohl(result);
  end;


function LongToIp(Long: Longint): string;
var
  ipx: array[0..3] of Byte;
  i: Byte;
begin
  Longint(ipx) := long;
  Result       := '';
  for i := 0 to 3 do Result := Result + IntToStr(ipx[i]) + '.';
  SetLength(Result, Length(Result) - 1);
end;



but I don't have haven the correct answer from thoese two function

My Default GetWay:192.168.1.1 vpn host
my ip :192.168.1.103 in vpn
The GetWay above 192.168.1.1 : 218.86.198.1
mask:225.225.225.0
first DNS:202.98.192.68
second DNS:192.168.1.11


with the two function run

I got getway as 128.1.1.223 why?
where did 128.1.1.223 come from?

and I ping 128.1.1.223 I cant ping through it.

I can ping through 192.168.1.1 192.168.1.103 218.86.198.1 first DNS:202.98.192.68
second DNS:192.168.1.11
I only live for Lord!
I love Lord!
forLord
Member
Member
 
Posts: 1
Joined: May 12th, 2005, 4:18 am

Postby Stefan » May 12th, 2005, 6:38 pm

User avatar
Stefan
Moderator
Moderator
 
Posts: 128
Joined: September 27th, 2004, 9:40 am
Location: Tilburg, The Netherlands


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 22 guests

cron