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

增加初始化时端口占用检查 #58

Merged
merged 2 commits into from
Aug 4, 2024
Merged

增加初始化时端口占用检查 #58

merged 2 commits into from
Aug 4, 2024

Commits on Jul 30, 2024

  1. bugfix: add initial bind port check

    Assuming there is a "nc" process run before zjuconnect, which listening same tcp/udp port. By rights zjuconnect need report this port is already in use and exit, however due to "nc" use "SO_REUSEPORT" and "SO_REUSEADDR", zjuconnect still can bind to this port successfully, however the behavior for all sockets bound to that port is indeterminate (https://learn.microsoft.com/en-us/windows/win32/winsock/using-so-reuseaddr-and-so-exclusiveaddruse#using-so_reuseaddr). So we need to check for any potential port conflicts during initialization.
    
    Be attention that we use a strict policy to check, for example assume nc listen to local TCP addr "192.168.189.123:1234", and we want to listen to 127.0.0.1:1234, we also prohibit this operation although this operation maybe legal.
    cxz66666 committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    6c0309a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2ab8025 View commit details
    Browse the repository at this point in the history