Suppose I have an application that access data resident in a central DB server and more than one user access data from client machines networked with the DB server.
Suppose two client machines are running a copy of the application and two users are accessing the same DB table.
How can I automatically refresh the data on the GUI, that is being viewed by one client, as soon as a change is made by another client in the DB table-data?
Which technology should be used to solve this particular scenario in .net?
WCF?
You are looking for a notification push model. You'd have to create seperate connections from the server back to each client. Lots of hard work. WCF / sockets for this. Comet in a web server environment.
Much easier way to do this is to poll the server every 15 seconds or so from the client and check if there has been an update. Store a last updated timestamp on the server and if it is greater than the timestamp you have then do a refresh.
Related
I have been thinking of the best solution to query the data from remote machines with internet access but without public IP
I have a plenty of intel NUC machines and the AWS-based server machine. I have ASP.NET MVC application deployed on the server
User will open the particular page, press the button and then he needs to see the data from the remote intel NUC machine on the page.
My understanding is that I can use WCF duplex mode to access the clients from the server and have the windows service (WCF client) istalled on the client machine and communicating with the hardware. But the thing is that the hardware SDK gets data in chunks and the read time couuld be up to 20 seconds (200 chunks) for example, and I want the user to immediately see the data as soon as the subsequent chunks is ready. Not sure if WCF is the best
The second solution came into my mind is the following: by pressing the button the server will send the SignalR command to the client. After receiving the command the client will start fetching the data and send to the server using POST-request or whatever. Then the server will store the data in some in-memory storage such as Redis and the UI client will get the data and show.
Could you please advice? Am I crazy?
Ok I have been given a task to create like ticket system in the factory I'm working in where operators will generate like a ticket which is stored in a database and also sent to an Engineer to act upon. The database is a MS SQL database which is running on a virtual server.
Each user will have a client desktop app which is developed in WPF.
I'm stuck on how to impalement the alerting for the engineers. When a ticket is generated it will be stored in the database and then a message or something needs to be sent to the engineers. So far I came up with the following thoughts for what I could use.
Webservice - Clients connect to this which is used to communicate to the database and relay ticket messages to the engineers.
Windows Service - Same as above but as a windows service? Is there a benefit?
Database polling - The client software for the engineers continuously poll the database say every 2 mins and checks for newly generate tickets. If any found then the user is notified.
The database polling is probably the easiest to implement but its not really live due to the delay. I mentioned the 2 min delay as there will be around 30 people connected at once and I would say 12 of those would be Engineers and I didn't know if 12 client programs continuously polling would affect the server performance.
Any advice would be great or if anyone knows of a better way.
The way to go if you dont want to use polling (which would not be a problem with 30 users) would be a WCF service with a callback contract which allows you to send events back from the server to the client.
example: WCF Callbacks
My boss wants me to create a desktop application with a database that is accessible via the Internet. The database is used to store information taken from a TCP server, but that is not my question.
so far on my research, I found shared web hosting, VPS, dedicated hosting and Amazon RDS to be possible choices. The only interest I have is the MySQL Server included in the given package.
I think for a simple application a regular shared web hosting is enough, merely because the database is consists of 10 tables and records won't likely exceed more than a thousand records.
But my question is, is it possible to directly connect a C# application to a MySQL instance from a web server? And if it does is it secure? It will be storing vital information such as credit card numbers, and member information and needs to be up all the time.
You can easily connect to a MySQL database from any computer as long as your firewall do not block port 3306 on the database server. However, I strongly discourage you from doing so since you loose control over the clients.
Each client needs to store the database connection somewhere (or fetch from some kind of server)
You need to be able to update the MySql connector on all clients
You get very little control over the data access.
Instead I would introduce some kind of data access layer that the clients would use. You could for instance use WCF Data Services or build your own very simple data layer (let the clients send SQL queries and return the proper result) using WCF.
Both those options lets you use any technology behind (you can even switch database server without the clients noticing).
This is the scenario.
I have multiple clients on our application, and one server.
The server is itself disconnected from the clients, it just downloads some data from the web via a windows service (web services and FTP), processes the data and updates a database to which all the clients are connected and draw data from.
I would like to be able to actively notify the clients, and with a certain degree of granularity, when some downloading occurs (i.e. only the Traders when a price/trade update occurs, or only the Engineers when there's something for them) without polling.
The server should fire up a notification to all the connected clients instead of having them continuously "ask" if there is an update, because in this case I would have to maintain state on all the clients.
I thought about XMPP, with Matrix.
To do so each client has to open a persistent connection with the windows service, but I lack the exact details on how to implement this. MAybe with nodes!
For what I understand XMPP is perfect for what I want to accomplish and gives me the extensibility to grow to some more functionality if I have the need to.
I don't know if to implement my own server or use one of the existing one (I hear jabberd2 has an excellent windows server).
But most important: I need suggestions on A) an XMPP server to run on Windows and B) a C# library. Besides Matrix I have found very few, and above all I need notifications support (pubsub).
For simplicity, I'd consider using a WCF service that implements a long polling technique. This article gives some details on scaling the WCF service efficiently.
For notifications that there is new data in the database, if you are using SQL Server, try SqlDependency. It allows you to set up an event that fires in your code whenever the result of a given query changes. I've used it effectively for just this sort of thing.
I want to create an application in C# with client and server sides. It will work over local network. Client sides must check for updates on a remote SQL Server. Lets say we've set update time interval to 2 seconds. If i have 20 client side applications, then they'll send query to the remote SQL Server every 2 sec and it will load server quite a lot. Now I want to know is there any way to reduce server load or it's only way to check for updates?
From my point of view, there is no need to allow clients to connect the DB serer directly. There should be one more tier here which will only connect to the server and cache information about the updates. Your clients should connect to this additional information and work with the cached info.
UPDATE
As far as I understand, the problem appears because all your clients ping your DB server every two seconds. The solution to this problem is to create a special module which will only have access to the DB server and asks it for the update. For example, every two seconds. If the update is ready, it should be able to fetch it from the DB and store. This is what I meant under the additional tier.
Now, let's return to your clients. They should be able to communicate with this module and get information from it about a ready update (this information is cached and thus it is really fast to obtain it. Also you needn't ping the server at every client request). If update is ready, fetch it to the client side and work on client side.
As for the communication between this additional tier and clients. Since you are working with .NET, I would suggest that you take a look at the WCF which, from my point of view, becomes a standard approach of implementing the between-process communication in .NET. There are a lot of information in the network about it, I will post the links shortly.
Here is my favorite WCF book:
Programming WCF Services
MSDN entry:
Windows Communication Foundation