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

Use the socket to obtain available ports to resolve port number conflicts #673

Merged
merged 4 commits into from
Aug 15, 2024

Conversation

Puiching-Memory
Copy link
Contributor

@Puiching-Memory Puiching-Memory commented Aug 12, 2024

Description

  1. 使用socket.bind()自动获取可用端口机制,获取可用端口,解决端口占用问题

依然可以使用-p xxxx 来指定端口号

🎯 PRs Should Target Issues

closes: #502

@Puiching-Memory
Copy link
Contributor Author

补充:只在windows环境下测试过

@Zeyi-Lin Zeyi-Lin requested a review from SAKURA-CAT August 13, 2024 08:16
@SAKURA-CAT
Copy link
Contributor

最好还是将端口默认指定为5092,作为swanboard的默认开启端口,只有当此端口已被占用,才选择其他端口

@SAKURA-CAT
Copy link
Contributor

SAKURA-CAT commented Aug 15, 2024

我将代码做了一些更改,并添加了简单的测试样例

@SAKURA-CAT
Copy link
Contributor

最好还是将端口默认指定为5092,作为swanboard的默认开启端口,只有当此端口已被占用,才选择其他端口

其实比较好的方式是端口号顺延,不过随机端口也可以,并且比较简单。

@SAKURA-CAT SAKURA-CAT added the 💪 enhancement New feature or request label Aug 15, 2024
@SAKURA-CAT SAKURA-CAT merged commit cbbb21e into SwanHubX:main Aug 15, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ADVICE] 本地开启服务时,端口号顺延
2 participants