getting client IP address in a webserver

72 views Asked by At

I developed a simple webserver in Delphi. It is a stand-alone type. How can I get the client IP address when a client connects to the server?

I saw this line in the unit: FServer: TIdHTTPWebBrokerBridge;

how can I get the IP of a client which connects to the webserver?

2

There are 2 answers

0
Remy Lebeau On

TIdHTTPWebBrokerBridge is not a standalone web server (TIdHTTPServer is), it is used to connect Indy as the backend for Embarcadero's WebBroker tech. In which case, if you are actually using WebBroker for your server then the client IP is available in the TWebRequest.RemoteAddr property.

1
Ronaldo Brisola On

In a SOAP Server application, I've made something like this:

TwbServer = class(TInvokableClass, IwbServer)
  public
    function GetRemoteIP () : String; stdcall;
 end;

 function TwbServer.GetRemoteIP () : String; 
    var
       WebDispatcher: IWebDispatcherAccess;
    begin
       Supports(GetSOAPWebModule, IWebDispatcherAccess, WebDispatcher);
       Result :=  WebDispatcher.Request.RemoteIP;
    end;