問題描述
Як я магу рэалізаваць зваротныя выклікі на іншы сервер у C# (How can I implement callbacks to another server in c#)
I was assigned to make 2 servers and a client application.
- My service must generate random number from 1‑100 every second.
- Server A must display random numbers generated from a service.
- Server B must receive same feeds displayed by Server A from the service.
- Then the Client Application must receive same feeds received by Server B.
I know this would be about callbacks but I don't really know where to start. I tried to code, Server A and Server B displays the same but sometimes not and I know it is all wrong. Please help. I've been working with it for three days.
‑‑‑‑‑
參考解法
方法 1:
Sounds like you might need to implement a simple pub/sub system for this to work nicely. http://msdn.microsoft.com/en‑us/magazine/cc163537.aspx ‑ if you're using WCF..
Because you don't really supply any specifics ‑ I would have thought that you first need to connect server A and B to be subscribers to the Random Number event. And the client to have a different subscription based on what A and B do..
So the workflow is this... Server A makes call to the random number service periodically... When it recieves its response it publishes a message which server B and Client is subscribed to.. Each time this happens Server B and Client receive an event. Again see the link I supplied for more detailed info..
(by Brenelyn、The Unculled Badger)