2010-01-29 65 views

回答

5
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; 
+0

'DSConnectEventObject.ChannelInfo.Info'總是返回服務器的IP地址,這是一個錯誤還是我錯過了什麼? http://db.tt/lmRoqD2 – 2010-08-29 00:33:04

3

您查詢Request.RemoteAddr獲得附加的客戶端的IP地址。

+0

RemoteAddr是TWebRequest的方法,我認爲這不是在入店的DataSnap。 – 2010-01-30 11:30:51