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

Implement dynamic port allocation to avoid conflicts #148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Stevo-G-Swag
Copy link

@Stevo-G-Swag Stevo-G-Swag commented Nov 2, 2024

Fixes #147

Implement dynamic port allocation to avoid conflicts with reserved ports.

  • computer-use-demo/image/x11vnc_startup.sh

    • Add functions to check port availability and find an available port.
    • Dynamically assign the VNC server port instead of hardcoding port 5900.
    • Update the netstat command to use the dynamically assigned port.
  • computer-use-demo/image/novnc_startup.sh

    • Add functions to check port availability and find an available port.
    • Dynamically assign the VNC server port instead of hardcoding port 5900.
    • Modify the --vnc option to use the dynamic port.
  • computer-use-demo/image/port_check.sh

    • Create a script to check port availability.
    • Use lsof to check if a port is in use.
    • Return an available port if the specified one is in use.
  • computer-use-demo/.ports

    • Maintain a list of reserved ports.
    • Include common ports used by macOS and other systems.

For more details, open the Copilot Workspace session.

Fixes anthropics#147

Implement dynamic port allocation to avoid conflicts with reserved ports.

* **computer-use-demo/image/x11vnc_startup.sh**
  - Add functions to check port availability and find an available port.
  - Dynamically assign the VNC server port instead of hardcoding port 5900.
  - Update the `netstat` command to use the dynamically assigned port.

* **computer-use-demo/image/novnc_startup.sh**
  - Add functions to check port availability and find an available port.
  - Dynamically assign the VNC server port instead of hardcoding port 5900.
  - Modify the `--vnc` option to use the dynamic port.

* **computer-use-demo/image/port_check.sh**
  - Create a script to check port availability.
  - Use `lsof` to check if a port is in use.
  - Return an available port if the specified one is in use.

* **computer-use-demo/.ports**
  - Maintain a list of reserved ports.
  - Include common ports used by macOS and other systems.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/anthropics/anthropic-quickstarts/issues/147?shareId=XXXX-XXXX-XXXX-XXXX).
@p-i-
Copy link

p-i- commented Nov 2, 2024

I would recommend against merging this. Yes, hard-coding the ports is ugly. But a solution should be clean and complete.

I've bumped into conflicts of 5900 with VNC, and flagged this #147

I'll update my issue with a suggested solution path. I think that's the best structure.

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

Successfully merging this pull request may close these issues.

(MacOS) Ports are not available: 5900
2 participants