How to get client port?

Hi, using Delphi 12 and latest RO version.
I intercepted getDispatchInfo in order to get client IP address but we have lots of clients that use RDS where the clients share the same IP address so we’re looking for their port number in order to log client information.
The code that we have now is:

procedure TServicoMestre.RORemoteDataModuleGetDispatchInfo(
  const aTransport: IROTransport; const aMessage: IROMessage);
var
  ip: string;
  tcpinfo:IROTCPtransport;
  httpinfo:IROHTTPTransport;
  msgName: string;
  interfaceName: string;
begin
  inherited;

  // obtém IP
  ip := '';
  if Supports(aTransport, IROTCPtransport, tcpinfo) then begin
      ip := tcpinfo.GetClientAddress;
    end;
  if ip = '' then begin
    if Supports(aTransport, IROHTTPTransport, httpinfo) then begin
      ip := httpinfo.Headers['REMOTE_ADDR'];
      if ip = '' then ip := httpinfo.Headers['HTTP_CLIENT_IP'];
    end;
  end;

  // obtém nome da função/método sendo chamado
  msgName :=  aMessage.GetMessageName;
  interfaceName := aMessage.GetInterfaceName;

  SharedMatrix.AddItem(TRequestInfo.Create(ip, msgName, interfaceName));
end;

Is there a way to get its client port?

Hi,

what exactly server (TROHTTPServer, TROIndyHTTPServer, etc) are you using?

Logged as bugs://D19599.

bugs://D19599 was closed as fixed.

Hi, Actually I am using both.

TROHTTPServer in one server and TROIndyHTTPServer in other

Hi,

Check PM