There is a server and clients of two types: a control program (user) from which the user sends commands and programs (client) that actually execute these commands. The solution must ensure that commands are received and executed by clients. Most often (almost always) each client is on a separate machine. All participants are connected in a local network, it is possible that the local network is made specifically for these purposes and there are no extra clients in it. the user sends a command through user, it is accepted by the server and redirected to clients. Here the task is to ensure that clients execute the command as synchronously as possible in time (the maximum allowable out of sync is 40ms). There are practically no requirements for minimizing the time after which clients will receive a command from a user (1, 2, 3 seconds is quite acceptable) only these commands) C# development language. So far, I have implemented everything listed above based on System.Net.Sockets, everything works, but in 20% of 100% the maximum allowable out of sync is exceeded. I thought to teach the server to send its time via UDP clients will constantly synchronize their timers with this time and the server, when sending a command, will also report the time at which these commands need to be executed, but there is absolutely no trust in broadcasts. Does anyone have any ideas on how this can be organized? Thanks in advance for the replies.
Have you tried using SignalR (I know it's socket based, but maybe it's a better use of them)? It seems to keep the socket open all the time, data arrives accordingly, it goes overhead in time to process the code and send it over the network.