Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Remote Client IP Address
Wed, May 20 2009 10:32 AMPermanent Link

Kyle Boatwright
I am using DBISAM 3.24 and I am calling a procedure on a server from a client PC.  I have the ServerSession argument passed to the ServerProcedure procedure.  How can I get the IP
address of the client making the call to the server procedure at this point?

Thanks,
Kyle
Wed, May 20 2009 10:34 AMPermanent Link

Kyle Boatwright
Kyle Boatwright wrote:

I am using DBISAM 3.24 and I am calling a procedure on a server from a client PC.  I have the ServerSession argument passed to the ServerProcedure procedure.  How can I get the IP
address of the client making the call to the server procedure at this point?

Thanks,
Kyle


Sorry, I meant version 4.26...
Wed, May 20 2009 10:44 AMPermanent Link

"Eduardo [HPro]"
Kyle

I use the following function. I don´t remember if you need to add "Winsock"
unit at uses clause.

  function LocalIP : string;
  type
     TaPInAddr = array [0..10] of PInAddr;
     PaPInAddr = ^TaPInAddr;
  var phe  : PHostEnt;
      pptr : PaPInAddr;
      Buffer : array [0..63] of char;
      GInitData: TWSADATA;
  begin
       Result := '';
       WSAStartup($101, GInitData);
       try
          GetHostName(Buffer, SizeOf(Buffer));
          phe := GetHostByName(buffer);
          if phe = nil then begin
             Exit;
          end;
          pptr := PaPInAddr(Phe^.h_addr_list);
          Result := StrPas(inet_ntoa(pptr^[0]^));
       finally
          WSACleanup;
      end;
  end;

Eduardo

Wed, May 20 2009 1:25 PMPermanent Link

Kyle Boatwright
"Eduardo [HPro]" wrote:

Kyle

I use the following function. I don´t remember if you need to add "Winsock"
unit at uses clause.

  function LocalIP : string;
  type
     TaPInAddr = array [0..10] of PInAddr;
     PaPInAddr = ^TaPInAddr;
  var phe  : PHostEnt;
      pptr : PaPInAddr;
      Buffer : array [0..63] of char;
      GInitData: TWSADATA;
  begin
       Result := '';
       WSAStartup($101, GInitData);
       try
          GetHostName(Buffer, SizeOf(Buffer));
          phe := GetHostByName(buffer);
          if phe = nil then begin
             Exit;
          end;
          pptr := PaPInAddr(Phe^.h_addr_list);
          Result := StrPas(inet_ntoa(pptr^[0]^));
       finally
          WSACleanup;
      end;
  end;

Eduardo

Thanks, I really need the local IP address as it appears to the server (not necessarily the local IP address).  I think I have the issue resolved, I was using the CurrentRemoteID value from
the Session at the server and it was always zero.  I just created a server side procedure that I pass the CurrentRemoteID from the client to, then sift thru the list of session on the server
until I find that on and return the IP address to the client.
Thu, May 21 2009 3:18 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kyle,

<< Sorry, I meant version 4.26... >>

The latest 4.27 includes a new function for this:

http://www.elevatesoft.com/manual?action=mancompprop&id=dbisam4&product=d&version=7&comp=TDBISAMSession&prop=CurrentServerUserAddress

--
Tim Young
Elevate Software
www.elevatesoft.com

Image