Trigger events remotely

Asked

Viewed 63 times

2

What is the best way to trigger/receive an event remotely on C#?

Example:

When clicking a button on the PC1, perform certain task on the other PC’s that have the app.

I thought of 3 solutions:

  1. Socket
  2. Conducting database queries in 5s intervals
  3. Perform http queries that return some json at intervals of 5s
  • I didn’t understand it very well. You want to know which is the best option, out of the three?

  • Yes, or any other suggestion. @Renilsonandrade

  • 1

    I believe that solutions 2 and 3 are the easiest to do (at least in my view)

  • 2

    The performatic would look something like this: https://msdn.microsoft.com/en-us/library/ms973857.aspx

1 answer

2


It will depend on the architecture you used to build the software. If you have a server application, which provides connection to customers via Socks or WCF, then this is the way. Use the same layer architecture to send the information (Socks, wpf, remoting or other)

Now, if your client applications connect to the database directly, the solution could be to create a table and take the update from time to time. You could leave a thread running isolated on the client, checking for changes. This would avoid the construction of an exclusive server application for this purpose

The json case would only advise for web applications. If your application is web-based take a look at this Html5 resource.

http://www.w3schools.com/html/html5_serversentevents.asp

Browser other questions tagged

You are not signed in. Login or sign up in order to post.