Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am trying to build a chat app in c# that would work in the wan network.
There are 2 side in the app. Server side and client side.
In my thoughts i think that every message from client to client need to be passed to the server and the server will forward it to the right des client. The communications between the clients wont be directelly.
Is this the right model?
If yes, does the server need to have one socket that will listen to all clients? (Because every client sends his message to the same port at server).
Will the sever can handle management of million of messages on same port?
I think it is really up to what you want to accomplish, each choice has it's own pros and cons.
For example:
Using a centralized server can track messages , which users are online etc... but you will have to manage the ports for each connection (see explanation at the end of the answer for details).
Using a P2P model, you will not have the bottle neck and management required by the centralized server, but again it might be more of a hassle to manage a non centralized system (depends what exactly you want to accomplish).
If you are going to the centralized design, Typically You would have a server with a port that will listen for requests.
once a user wants to connect, the server will start a new thread for the client, and will assign a port for him (the thread will be typically from a thread pool and the port from a specific port range).
this will allow users to speak to the server in a non-blocking manner, and by that allow for multiple users to use the service simultaneously.
Take a look at SignalR and the chat system implemented using SignalR, Jabbr:
http://signalr.net/
http://about.jabbr.net/
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 4 years ago.
Improve this question
I have a windows app and a web service in server side, and on other side(client) a windows form application. I want to notify client from server when something change on server. One way is that client check the server constantly. But server will too busy because number of clients are about 100,000. What is the best way to do this?
One way is using a Duplex Contract
How to: Create a Duplex Contract
The duplex contract is one of three message patterns available to
Windows Communication Foundation (WCF) services. The other two message
patterns are one-way and request-reply. A duplex contract consists of
two one-way contracts between the client and the server and does not
require that the method calls be correlated. Use this kind of contract
when your service must query the client for more information or
explicitly raise events on the client
You could also use Signalr i guess
Introduction to SignalR
ASP.NET SignalR is a library for ASP.NET developers that simplifies
the process of adding real-time web functionality to applications.
Real-time web functionality is the ability to have server code push
content to connected clients instantly as it becomes available, rather
than having the server wait for a client to request new data.
Update [Answer to comment]
WFC and Duplex Contracts is very secure an reliable way to achieve your results. Signalr is a very lightweight approach and is'nt as robust or secure.
Yes you are right there is some sort of socket connection that will be required at the base level, though you really need to study these 2 options to work out what is mostly like best for you. I personally have had a lot of success with Signalr and use it often, its easy to setup, and fairly fault tolerant. Though if security and reliability is a concern then Duplex Contracts are probably your best bet
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 have more than 100 clients on different networks (not on LAN) e.g. one is in USA and other in UK and other in Dubai and so on.
My all clients PC using the same Windows application and their own local DB.and using internet with Router.as you know due to router public IP always change after 24 hour.
My server PC is in Australia and server is using web application.
Client PC can get access server PC using Windows Services.
But my question: how server pc will get the data from client PC's using web services or any in your mind?
Please give any good Idea with example of sample code, please don't give me any huge theoretical link to read. I want just sample code which I will write in my server side Web application and it will fetch data from clients PC .
Thank you.
You will more likely to succeed with syncing the clients with your server, not the other way round.
Syncing with the clients will bring about a whole host of security and configuration issues.
The opposite is a single server that all clients communicate with and send data.
The server can't fetch data from clients because off firewalls and dynamic IPs (which you pointed out). I think the clients will have to upload the data to the server. Can you tell us more about the "Windows Services" that enable the client to communicate with the server? Perhaps you can use this t allow clients to upload data to the server?
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 9 years ago.
Improve this question
I have designed a virtual classroom software for students with disabilities, it is being used by some local colleges. The limitation of the software is that the students within a Local Area Network (LAN) are able to connect with server in order to receive audio/video data. I have used sockets to connect clients with server. Now the demand for the software has increased and students outside of the LAN want to connect to server using their internet connection. I am aware that I have to rewrite the server/client connectivity modules, but I am not sure how to go about connecting clients to server using internet.
I think one way is to use a vpn but I am not really sure.
Any guidance would be much appreciated. Thanks in advance.
1)First, the good news: You may not have to rewrite your client server code (at least not completely)
2)This question may be better suited for serverfault
3)Get with your IT staff to discuss your needs. Developing the app without consulting them is asking for trouble, because they're going to be the ones to ensure the proper firewall ports are opened. Even if you had a VPN, without consulting them there's no guarantee it would even work. Because you would need
4)A routable IP address. Yes, DYNDNS or something similar would work, but that introduces another single point of failure. No IT staff? Then
5)Find an IT consultant knowledgeable in basic networking, or make heavy use of serverfault.