Search code examples
delphiip-addressdatasnaprecompile

Access Public IP Address in DataSnap XE / Recompile DataSnap Framework


The "procedure TDSTCPChannel.Open" method in DSTCPServerTransport.pas uses the connected user's private IP address when it assigns "FChannelInfo". When I traced the HTTP transport, it used the user's public IP. If DSTCPServerTransport.pas were updated such that

FChannelInfo := TDBXSocketChannelInfo.Create(Integer(FContext.Connection), FContext.Connection.Socket.Binding.IP);

was changed to

FChannelInfo := TDBXSocketChannelInfo.Create(Integer(FContext.Connection), FContext.Connection.Socket.Binding.PeerIP);

then DSTCPServerTransport.pas would match the HTTP transport implementation and the connected user's public IP address would be available in the TDSServer.OnConnect event via "DSConnectEventObject.ChannelInfo.Info" for TCP connections too. Several developers have discussed this in these two EBT discussions: Discussion #1, Discussion #2. The QC# for this is #91030.

I tried to make the change myself, but learned that I cannot re-compile the DataSnap Framework (see here).

Will this be fixed in XE2 and/or will end-users be able to recompile the DataSnap Framework in XE2? Will there be a patch to DataSnap prior to XE2 that will include this fix?

Thanks, James


Solution

  • I called Embarcadero yesterday about this and they confirmed that it has been fixed and will be available in the next general release (e.g., XE2).