panjf2000 / gnet

🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go.
https://gnet.host
Apache License 2.0
9.7k stars 1.04k forks source link

UDP fd什么时候调用close? #484

Closed iqinlongfei closed 1 year ago

iqinlongfei commented 1 year ago

Actions I've taken before I'm here

Questions with details

发现TCP连接在创建和关闭时会调用OnOpen/OnClose,但对于UDP,OnOpen/OnClose没有被调用。我想知道UDP连接什么是否会被释放。我的应用场景是使用gnet实现一个UDP server,请求都是ping-pong模式,因此在大并发情况下,担心fd不够用。

Code snippets (optional)

No response

panjf2000 commented 1 year ago

UDP 是不可靠协议,通信前不需要建立连接。