Get the IP address of clients in the RemObjects web service

I have a webservice implemented using RemObjects over Delphi XE, and I want to know the IP address of client requests. My service inherits from TRORemoteDataModule, and I have not found any way or object for this.

Any suggestion? thank

Note. I think that the information I need is returned in the method self.transport.GetTransportObject(), but returns a TObject, and I do not know how to extract this information.

+5
source share
2 answers

This is how I get it from SuperChannel:

procedure TMyInterface.RORemoteDataModuleGetDispatchInfo(const aTransport: IROTransport; const aMessage: IROMessage);
var
  tcpinfo: IROTCPTransport; 
  Session: TCustomSession;
  szClientIP : String;
begin
  Session := TCustomSession(Self.Session);
  if Supports(aTransport, IROTCPTransport, tcpinfo) then
  begin
    szClientIP := tcpinfo.ClientAddress;
    if (not Session.ShownTCP) or (Session.TCPAddress <> szClientIP) then
    begin
      Session.TCPAddress := szClientIP;
      Session.Report(leInformation, 'TCP address ' + szClientIP); 
      Session.ShownTCP := True; 
    end; 
  end 
  else 
  begin 
    Session.Report(leInformation, 'TCP address not available');
  end;
end;

, , , , , , . Ip, .

+4

All Articles