Broadcast like UDP with the reliability of TCP

后端 未结 16 1405
陌清茗
陌清茗 2021-01-30 02:30

I\'m working on a .net solution that is run completely inside a single network. When users make a change to the system, I want to launch an announcement and have everyone else h

16条回答
  •  时光说笑
    2021-01-30 03:15

    Create a TCP server. Have each client connect. In your TCP protocol with the clients, create each packet with a 2-byte prefix of the total size of the following message.

    Clients then call read(max_size=2) on the socket to determine the size of the next message, and then read(max_size=s) to collect the message.

    You get reliable, ordered messages, simple. You don't need a messaging framework for this one.

提交回复
热议问题