Answer the question
In order to leave comments, you need to log in
Which protocol is better to choose in this situation?
I am writing a program "remote control of a computer class". Computers in the network can be from 1-200. When the server starts, it sends a message via the UDP protocol to the specified IP range. Then there is the problem, I can not decide which suits me better.
There are two scenarios:
1) Clients receive the message and connect via TCP to the server.
pluses: you can quickly find out who is disconnected, it is easier to communicate with customers.
cons: I'm afraid that because of the large number of clients, everything will slow down.
2) Clients receive a message and send a message about their existence to the server via UDP protocol. And if the matter already goes to managing the client, then the server sends a request via UDP and a connection is made via TCP.
pros: less resources are used
cons: after a certain period of time, you will have to synchronize with the server to check whether the client is online or not. which can also take up some resources.
I personally lean towards the second option, but maybe I'm wrong. What do you advise?
Answer the question
In order to leave comments, you need to log in
I use the first approach, but with a few changes.
- The server sends a multicast message via UDP once every 30 seconds, which contains the UUID of the server and its IP.
- The server generates a new UUID each time it starts.
- The client remembers the UUID, and if it has changed (the server is rebooted), then it reconnects to the server via TCP.
I have up to 10,000 set-top-box clients. A simple computer on an intel-atom pulls 100-300 clients (I just didn’t connect more to the atom) without any problems, the CPU load is about zero, since the clients simply establish connections and wait for commands. For large installations, we immediately buy a server with iCore or Xeon for the customer, these pull much more.
All server software is written in python, the server itself is implemented on twisted + cyclone. Clients - javascript :-) and delphi :-) and python.
The second approach is better because at the connection stage, an undelivered packet does not scare anything. While during management, it is better to get rid of this, and use TCP.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question