开发者

How to get the client IP in DataSnap 2010

Someone can tell me how to get the client ip of a connected session from the server si开发者_运维知识库de?.

Thanks


procedure TMyDSService.DataSnapServerConnect(DSConnectEventObject: TDSConnectEventObject);
var
  Conn: TIdTCPConnection;
begin
   Conn := TIdTCPConnection(DSConnectEventObject.ChannelInfo.Id);
   Trace('Client ' + Conn.Socket.Binding.PeerIP +':' + IntToStr(Conn.Socket.Binding.PeerPort));
   Trace('Client info: ' + DSConnectEventObject.ChannelInfo.Info);
end;


You query the Request.RemoteAddr to get the ip address of the attached client.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜