servicestack - How to get IP of the client? -
i've wrote self-hosted servicestack server , client, both desktop applications. in basic ping test service i'm trying retrieve ip of client. server on 192.168.0.87:82, client tried on same computer , on computer, remoteip , userhostaddress return 192.168.0.87:82. xrealip null. tried base.request.remoteip, still 192.168.0.87:82.
what doing wrong?
public respping any(reqping request) { string ip = base.requestcontext.get<ihttprequest>().remoteip; string mac = request.itransactioninfo.mac; log(mac,ip, base.requestcontext.get<ihttprequest>().remoteip + base.requestcontext.get<ihttprequest>().xrealip + base.requestcontext.get<ihttprequest>().userhostaddress); respping response = new respping { result = "pong" }; return response; }
thanks!
made with:
httplistenerrequest ihttplistenerrequest = (httplistenerrequest)base.requestcontext.get<ihttprequest>().originalrequest; string ip = ihttplistenerrequest.remoteendpoint.tostring().split(':')[0];
request.remoteip
kept giving me server address.
Comments
Post a Comment