Use of Socket.BeginAccept/EndAccept for multiple connections

前端 未结 2 1032
甜味超标
甜味超标 2021-01-19 07:57

Unlike the synchronous Accept, BeginAccept doesn\'t provide a socket for the newly created connection. EndAccept however does, but it

2条回答
  •  感动是毒
    2021-01-19 08:20

    This is normal when you deal with callback-based async IO. And it is what makes it so awful to use!

    Can you use C# await? That would simplify this to a simple while (true) { await accept(); } loop.

提交回复
热议问题