I am writing an instant messaging server in C # for training. My question is whether to use synchronous or asynchronous sockets to handle IM clients. The goal is to handle as many customers as possible.
I'm not quite sure, but as far as I know, packets do not arrive in order with asynchronous sockets, which means that when you send 2 chat messages and there is a delay / lag, it is possible that the second comes before the first. Is this correct, and if so, is there a way to solve this problem?
About synchronization sockets: Are synchronous sockets a good solution for many clients? Do I need to check every socket / connection in a loop if there are new packets? If so, isn't it so slow?
Last question: suppose I want to implement a way to send files (for example, images) via a protocol (which is a non-standard binary protocol), can I send messages at boot time?
source share