Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Database/DataSnap/Server    [ Add a report in this area ]  
Report #:  121930   Status: Closed
TDSServer can not get the Client IP via Request.RemoteAddr in its OnConnect event
Project:  Delphi Build #:  XE, ... XE5
Version:    19.2 Submitted By:   Eden WU
Report Type:  Crash / Data loss / Total failure Date Reported:  1/23/2014 11:17:46 PM
Severity:    Serious / Highly visible problem Last Updated: 1/7/2015 4:39:38 PM
Platform:    All versions Internal Tracking #:  
Resolution: Duplicate (Resolution Comments) Resolved in Build: : XE7 Update1
Duplicate of:  121931
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
TDSServer can not get the Client IP via Request.RemoteAddr in its OnConnect event

For example, sometimes, "Request.RemoteAddr" is empty string.
Steps to Reproduce:
1. Create DataSnap Server

2. DSServer.onConnect set code, below:
// _ServerWebModuleUnit1.pas
procedure TWebModule1.DSServer1Connect(
  DSConnectEventObject: TDSConnectEventObject);
var _SS: string;
    _SS := string(Request.RemoteAddr);
    if _SS = '' then
      _SS := 'Empty String';

    TDSSessionManager.GetThreadSession.PutData('RemoteAddr', _SS);
    if _SS = 'Empty String' then
    on E: Exception do
      _SS := E.Message;

3. Create DataSnap Client

4. Continuous call service function to server from client.
// _ClientUnit1.pas
procedure TForm1.Button1Click(Sender: TObject);
var _Pos: Integer;
  for _Pos := 1 to 1000 do

Tomohiro Takahashi at 1/24/2014 12:52:47 AM -
> DSServer can not get the Client IP
Could you please attach sample project(server/client) to reproduce/confirm your issue?

Eden WU at 1/24/2014 1:24:13 AM -

Tomohiro Takahashi at 1/24/2014 5:43:44 PM -
I attached the to this report instead of you.

Tomohiro Takahashi at 1/24/2014 7:31:03 PM -
I tried to build Project3.dproj, but I get compile error.
  [dcc32 Error] main.pas(65): E2003 Undeclared identifier : 'TDSSessionManager'

So, could you re-attach sample projects by using Windows Native QC Client?
The standalone client(QualityCentral.exe) is included in Delphi.

Eden WU at 1/25/2014 2:07:42 AM -
XE and XE5 is not same at USES Unit.

The WebModuleUnit with XE5.

Because, I can not re-install XE5 (now, I only installed XE in my work PC), so I can not re-build the demo project with XE5.

Tomohiro Takahashi at 1/25/2014 6:11:26 PM -
.dfm file is missing.
So, for testing your case with Delphi XE5, could you re-attach sample projects to [Attachments] tab of this report?

Tomohiro Takahashi at 1/26/2014 12:48:08 AM -
> Sometimes, "Request.RemoteAddr" is empty string.
> 4. Continuous call service function to server from client.
Could you tell us more detail about 'Sometimes'?

Eden WU at 1/26/2014 6:12:47 PM -
Error Demo with XE5:

Connect and Disconnect 1000 times continuously.
Sometime, have get "Empty String" or Except.

The Pic, below:

Could you tell me, how to correct get a client's remote ip with DataSnap?

Tomohiro Takahashi at 1/26/2014 8:50:32 PM -
I attached it(as a .zip) to this report instead of you.

Tomohiro Takahashi at 1/26/2014 8:45:16 PM -
Is this report duplicate of QC#121931 ?

Eden WU at 1/26/2014 9:41:01 PM -
No, QC#121930 and QC#121931 are two problem from own program produced.

Tomohiro Takahashi at 1/26/2014 11:59:58 PM -
ok, but this issue is due to a bug mentioned in QC#121931.

Tomohiro Takahashi at 9/3/2014 5:32:59 AM -
If possible, could you retest this issue with upcoming Delphi XE7(Trial / Enterprise)?

Server Response from: ETNACODE01