Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

需要设置超时时间(DeadLine),是否可以把底层的 net.Conn 暴露出来? #277

Closed
ycyuxin opened this issue Nov 20, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request proposal Proposal for this repo
Milestone

Comments

@ycyuxin
Copy link

ycyuxin commented Nov 20, 2021

从 Issues 中发现类似的需求还不少:

如果把底层的 net.Conn 暴露出来,就可以使用下面的代码设置超时时间了:

c.NetConn().SetReadDeadline(time.Now().Add(3 * time.Second))

不知道作者有没有考虑这么做呢?

@ycyuxin ycyuxin added enhancement New feature or request proposal Proposal for this repo labels Nov 20, 2021
@panjf2000
Copy link
Owner

gnet 底层没有使用 net.Conn,是自己实现的,之前没有做是考虑到应用层实现这个功能也不麻烦,不过这个功能会在 gnet v2 中实现,v2 应该会实现 net.Conn 这个接口的所有方法。

@panjf2000 panjf2000 added this to the v2 milestone Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request proposal Proposal for this repo
Projects
None yet
Development

No branches or pull requests

2 participants