Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am working on a WPF application that requires access to a remote database. The problem is:
The app does not have consistent access to the internet
There are multiple instances of the application running
My thought was to get a local copy of the database, log all the interactions with the local database (or someway to queue the interactions for later use), then have the option to sync the remote and local database (send the local commands to the remote database, drop the local database, get the remote database).
This article on MSDN was pretty helpful, but I have some concerns. The main purpose of the queue is to store updates and inserts to the local table, but this route does not look like it stores the parameters for use (has them commented).
Any suggestions or thoughts on the best way to handle this?
Thanks!
You should probably look at message queues (the Microsoft version is called MSMQ and is built into Windows. Other message queues are available). They are designed for exactly this sort of scenario.
Essentially, your application write an event to it's local message queue. This will attempt to send it to the remote queue (on the database in this case) periodically, providing for reliable message delivery.
On the database queue you typically have a listener watching the queue and writing any events it receives to the database.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 months ago.
Improve this question
I apologize for the multiple questions but I am having a hard time finding information on exactly what I am trying to do here.
Background:
I am working on a project that involves communicating with several server ports simultaneously that needs to somewhat scale. Some background on the project is I have a web application for users to pass commands to a console application. This console application will then send those commands to a specific port on a preexisting server through a tcp client.
My specific questions regard the console application communicating with the preexisting server.
My idea:
So my idea is to use a producer-many consumers thread scheme. I will need to be able to communicate with up to 300 different ports simultaneously and constantly through TCP connections. This console application will run as a windows service or something along those lines.
Question 1:
I am thinking of using a ConcurrentDictionary<string,ConcurrentQueue>() to track a queue of commands for every specific thread. Is there a better way to do this? I ask because I assume every thread would need access to the entire Dictionary of commands correct? Maybe this is a good approach but I have never done something like this.
Question 2:
Does spawning a single thread for each port I need to send commands to on the server make sense? The only reason I am thinking of doing this is because I will need to keep a TCP connection open for a very long time. The user can choose when to shut down the tool/connection. The only requirement really is this needs to be communicating for days at a time. The MOST I will reach is about 300 threads using this approach.
Question 3:
Obviously using an asynchronous approach is going to be necessary for this to scale well. Can anyone point me to some GOOD not out dated resources of the PROPER way to implement something like this asynchronously. I am willing to even pay for a book / online course if you have a good recommendation. The Microsoft docs are not very helpful because they do a scheme of 1 send and 1 read and then close the tcp connection.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I want to create an application which will be multiple client server application. All the computers are connected via the LAN. I want to generate a push notification on the admin computer when a client makes a query request. The notification should be real-time without loading the dashboard.
If you are up for rolling your own, you could potentially look into RabbitMQ. Its a free open source robust messaging system that would allow you to publish message to an exchange from the admin computer. Then the clients would subscribe to get the notifications/messages.
They have good getting started tutorials over on the main website. In particular, you might want to look at the Publish/Subscribe tutorial
You can use nuget to pick up the offical RabbitMQ C# library. Although, once you have your exchange & queues setup inside RabbitMQ you can even send the messages to the queue from anywhere using HTTP POST messages if you wish.
However, you would need to setup RabbitMQ on a server somewhere which might be a deal breaker if you havent got access to a server to install rabbitMQ on. It would need to sit there in the background to processing the messages for you.
That my 2 pence worth.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have created a web system to display a timetable of teachers.
Teachers have a desktop application (used C#) in their laptops with the same system as web system.
THE CASE IS;
- When the teachers connect to Internet they can fetch the timetables allocated for them.
- Teachers are allowed edit the timetable using their desktop application.
- They must have the ability to sync it to the web system when Internet connection is there.
PROBLEMS:
- I have no idea about how to sync these updated data to the online database.
- How can I temporarily store the fetched , and (or) edited data in the desktop application without creating a temporary database?
- Is there any technology/ plugin to do this task easily?
IMHO, the best option would be to have a local store that can store the application data and sync up with the server whenever the internet connection is working.
The mode would be a database, however, a secure file system also sounds fine.
There is a great deal of thought process involved with using the offline sync model. There should be a conflict check with the server before any data gets overridden to the db. Also, the client app should not loose data between restarts.
I would suggest that you decide on the right approach to sync data, prepare and review the process and consider Various algorithm's for the sync. In case of any specific questions, please post your questions here.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Is there a way to call a function to run on all instances of a Windows Forms application across a LAN?
I have an application which contains a dashboard of their own Joblist. I want another user on another PC to create and allocate a job to this user. Once created and saved, I would like the method GetJobs(); to refresh. I've not done anything this advanced yet, so please go easy :)
Chris Walsh has excellent advice in his comment. That said, it is possible for Windows Forms applications to communicate with each other, and the simplest method, for me anyway, is WCF, self-hosted server. Typically the server code will not be running in the UI thread -- at least I don't recommend it. In fact, all WCF is best kept running in a background thread in a Windows Forms application, to avoid blocking the UI. WCF has lots of error conditions you will need to handle.
Another thing you might want to look at is MSMQ, now called Message Queueing. It can store a queue of jobs for you, and it won't lose them if the power is lost.
I assume you have some SQL Server Express Edition installed as the database backend.
This way you can connect to the database using some authentication, and add the job's directly there.
Then on the other computer, add a refresh button or poll for changes. This has the advantage that you don't need to write a service by yourself, and jobs can be created even if the user is not there and his PC is switched off.
You need just one server which hosts the database.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to create a simple multiplayer game. As I understand the main principle is to make clients communicate ether directly to each other or to the server. Since I want some game data to be available online on my website, I'm inclined to create database that users will be connected to.
Is this valid?
Is SQL/MySQL good idea to use in such scenario?
Would windows azure be any help?
Please help me. I really need some guidance here.
If you want to store game data for use on a web site, you will definitely want to store it in some sort of database. Just so you know, SQL is a querying language for databases, MySQL is a DBMS (Database Management system) that you use SQL to "talk" to.
However, you certainly don't want to store ALL of your game interaction in a database, as database operations tend to take a long time (at least as far as a computer is concerned). Your server should have some sort of socket (probably TCP) that is talking to all the clients, passing messages and so forth.
The class reading from this socket would raise events or otherwise update the database for the information you want to be displayed on your website. Windows Azure would be a perfectly valid hosting platform for the website/server app, and so would pretty much any other web hosting solution. Some of the socket code could be easier going through Azure, so that may give it an advantage when choosing your host.
Please let me know if I can provide any more information.