1

I need to have a list of computers (i think IP addresses will be enough), that are allowed to connect to .net remoting server.

For example I have a list of allowed IPs on the server. How can I check an IP of connected client?

yurart
  • 593
  • 1
  • 6
  • 23
  • I guess you're using sockets so you can take a loot at: http://stackoverflow.com/questions/1904160/getting-the-ip-address-of-a-remote-socket-endpoint – Adriano Repetti Feb 28 '12 at 10:42
  • 1
    I use .net remoting. All socket connections in this case are encapsulated by the framework, so I don't understand how to get information about IP address of connected client. – yurart Feb 28 '12 at 10:45
  • Where you aware that .NET Remoting has been deprecated in favor of WCF? – John Saunders Feb 28 '12 at 14:55
  • There are some restrictions associated with target operation systems. That's why I don't use WCF that I'd like to use – yurart Feb 29 '12 at 11:28

2 Answers2

1

You can create your own channel. It's a little bit tedious but you can derive from default implementation just to add the check you need. You may take a loot at: http://www.codeproject.com/Articles/4175/NET-Remoting-Customization-Made-Easy-Custom-Sinks

Adriano Repetti
  • 65,416
  • 20
  • 137
  • 208
-1

I've understood that it can be done much more easier. It is needed just to create a TCPClient on the client side and connect to server that determines IP and sends it back to Client. So that's how client can find its IP.

yurart
  • 593
  • 1
  • 6
  • 23
  • I didn't understand...does the client need to know its IP address from the server? Anyway take a look to this too: http://msdn.microsoft.com/en-us/library/aa720499(v=vs.71).aspx – Adriano Repetti Feb 29 '12 at 17:12
  • Client must provide its IP to the server. And since the client cannot determine its own IP by himself or server cannot determine it through remotion, it uses server to determine its IP. All this is needed because .net remoting doesn't have an authentication system. Thanks for your response! – yurart Feb 29 '12 at 18:36
  • About your link.. I don't want to write too much code just to determine client's IP. – yurart Feb 29 '12 at 18:40
  • A client can always determine its own IP! (its list of IP addresses, if multiple you have to match with the subnet of the server) – Adriano Repetti Mar 02 '12 at 15:20