简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM