RPC windows get client IP

I have read the downloads of Microsoft documentation regarding RPC programming and still have not figured out how we get the client connection IP from the RPC server.

I'm sure there is an easy way to get the client IP address from the server when connecting, but I don't know how: /

Thanks for the help, a simple pointer to the documentation would be great.

+3


source to share


2 answers


No - there is no documented way to accomplish this. Windows RPC, by design, abstracts the network transport (and associated metadata such as network addresses) from the clients.



If you really need something like this, you can bake it into your interface (for example, implement the Connect () method when your client provides it with an IP address, which you could write in the Context Pen ). This assumes, of course, that you can trust your clients to provide valid IP addresses ...

+3


source


It should be possible to use RpcBindingServerFromClient. Request documentation for RpcBindingServerFromClient :

To request the address of a client, the application begins by calling the RpcBindingServerFromClient function to obtain a partially bound server binding handle. The server binding handler can be used to obtain a string binding by calling RpcBindingToStringBinding. The server can then call RpcStringBindingParse to extract the client's network address from the string binding.



UPDATE 16/05/2017: There is also an undocumented function I_RpcServerInqRemoteConnAddress () that will most likely return the client's IP address. But I haven't tried it yet.

+2


source







All Articles