pdt012 / HSocket

python;c++;c#的 socket封装。三种语言实现的纯文本/json传输协议; 支持并发的python服务端。
0 stars 1 forks source link

Partially Reliable Transmission Over UDP Support #2

Open zinc0x1E opened 1 year ago

zinc0x1E commented 1 year ago

I'd like to add partially reliable transmission over udp (PR-UDP) support to hsocket.

May be we can name our implementation as HProUDP?

This feature aims to provide a more reliable transmission than those over raw UDP and a more flexible config and a better performance than those over TCP.

Note that the aim is a partially reliable transmission, though user may configure it into a state that is as heavy and reliable as TCP or as simple as UDP, but its not our final goal. Say if raw UDP is like 0 and TCP is like 1, our ultimate goal is to provide user a totally flexible choice in the range of [0, 1]

The implementation will be like to implements a reliable UDP like we discussed before, but adding more configurable fields like buffer size, ACK strategy and congestion control strategy. But before all these things, I'd like to do a refactor, providing something like HStreamClient / HStreamServer, HPacketClient / HPacketServer. Then, our PR-UDP can be one of implementation of HStreamClient / HStreamServer and part of current packet transmission over TCP can be one of implementation of HPacketClient / HPacketServer. Thus, we can provide a unified user interface.

But after all, it's just a simple draft of my idea and we don't have any single use case for now, the final decision is up to you.

There're some interesting blog articles you may be interested in:

zinc0x1E commented 1 year ago

Also I'm not very sure whether to put this work in this repo. It already sounds like something too fundamental to implements it in a application level (maybe?) repo like hsocket and in python

zinc0x1E commented 1 year ago

image

a conceptual design