1

I currently have a .Net remoting service that can be accessed by different ways:

  • Locally through an IPC channel
  • Remotely through a TCP channel
  • Locally through a TCP channel

I need to known, in one of my service method, if the call has been made locally or remotely(depending on a licence, I've to send smaller data remotely).

I can't find a way to find this.

I've already a custom IServerChannelSink, I thought that I can detect which type of channel is used of this call, and if it's a TCP one, check it's IP, but I can't find how.

Do you have any idea about how to check if we have a local call or not?

Thank you for the help

J4N
  • 19,480
  • 39
  • 187
  • 340

1 Answers1

1

This question shows how to identify the client using its IP address. As you've already got a custom server channel sink it should be fairly straight forward.

Community
  • 1
  • 1
nblackburn
  • 338
  • 2
  • 10
  • Yeah, but in the case of a local IPC channel, how to know that we are in the case of the IPC channel? – J4N Apr 24 '13 at 19:35
  • @J4N If an IPC channel is used then `CallContext.GetData("ClientIPAddress")` will return null. – nblackburn Apr 25 '13 at 12:21
  • Yeah right(in fact it's the `requestHeaders[CommonTransportKeys.IPAddress]` that is null, but I see, I can manage that like this, thank you! – J4N Apr 25 '13 at 12:46
  • @J4N Or you could check for a null IP address in the `ClientIPServerSink` `AsyncProcessResponse` and `ProcessMessage` methods and do something like `CallContext.SetData("ClientIPAddress", "IPC");`. – nblackburn Apr 25 '13 at 12:46
  • Yes, it was what I was meaning – J4N Apr 25 '13 at 13:07