Demonstrates using .NET Remoting to broadcast to client subscribers. There are three parts:
1) Server.cs - for console app responsible for broadcasting messages (date/time stamp currently)
2) Client.cs - for console app that registers with server to subscribe to broadcasts
3) Agent.cs - class library that facilitates/eposes the interfaces for our client/server communication
To use, create the three project types defined above and include the appropriate code found in this snippet. In both the Server and Client projects, add references to the Agent.DLL project. Then, modify the IP address in the ClientClass's creation of the AbstractServer remoteObject to a string that represents your server's IP.
I began this experiment 2 - 3 weeks ago and have been waiting to perform static IP testing outside my LAN/LOCALMACHINE, but have not yet been able to. I decided to go ahead and comment the code, readying it for posting, while I was reading a very interesting and informative post titled "Peer to Peer Chat", which has nothing to do really with this snippet (LOL). Anyway, I have commented my code and am posting it as-is, but I think it should work over the internet.
Server broadcast events occur on a Timer (timer code aquired via a thread replied to by sknake--I love this guy's code!). The clients receive the broadcast by registering an event handler with the server (ClientEventHandler).
Communication/interfacing accomplished ia client adding a broadcast event handler (+= ClientEventHandler) …