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

UDP 如何设置本地端口 #302

Closed
zh1an opened this issue Nov 11, 2022 · 2 comments
Closed

UDP 如何设置本地端口 #302

zh1an opened this issue Nov 11, 2022 · 2 comments

Comments

@zh1an
Copy link

zh1an commented Nov 11, 2022

UDP 的客户端在连接服务器时,有可能需要指定本地端口,但是没有找到对应的接口。

@ithewei
Copy link
Owner

ithewei commented Nov 11, 2022

UdpClient::createsocket返回值就是socket fd,自行调用bind就是了

@zh1an
Copy link
Author

zh1an commented Nov 12, 2022

好的,谢谢,已经成功了。

话说,咱的接口里为啥不写 bind 方法呢?有啥特殊需求吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants