davidfowl / BedrockFramework

High performance, low level networking APIs for building custom servers and clients.
MIT License
1.04k stars 152 forks source link

TCP stick package and unpacking #91

Open xuanyuan5005 opened 4 years ago

xuanyuan5005 commented 4 years ago

Hi:David Fowler

Do you has a plan to process TCP stick package and unpacking?

xuanyuan5005 commented 4 years ago

Packet sticking and unpacking are inevitable in TCP network programming. eg: Client send two message; 1-> | Header | Length | AA AA AA AA AA AA| Rear | 2-> | Header | Length | BB BB BB BB BB BB | Rear |

Server received message are three scenarios 1 Normal Two message


| Header |  Length  | AA AA AA AA AA AA|  Rear |
_____________________________________________________
| Header |  Length  | BB BB BB BB BB BB   |  Rear |

2 Sticking One message

| Header | Length | AA AA AA AA AA AA| Rear | | Header | Length | BB BB BB BB BB BB | Rear |

3 Unpacking Greater than two message

  | Header |  Length  | AA AA AA AA
  _____________________________________________________
   AA AA|  Rear | 
  _____________________________________________________
  | Header |  Length  | BB 
  _____________________________________________________
  BB BB BB BB BB   |  Rear |
sunyuliang commented 3 years ago

这是最基本的功能,原始示例中的就有这功能