================================================================================
  COMMONWEALTH ONLINE - PORT TROUBLESHOOTING
================================================================================

ERROR: "Only one usage of each socket address ... is normally permitted"

This means port 7777 is already in use by another process.

QUICK FIXES:
============

Option 1: Use fix-port.bat / fix-port.sh (Recommended)
------------------------------------------------------
Windows: double-click fix-port.bat
Linux / macOS: ./fix-port.sh

Then choose an option:
   - Press 1 to kill the blocking process and restart
   - Press 2 to use a different port
   - Press 3 to cancel

Option 2: Manually change the port
-----------------------------------
1. Open commonwealth-server.json in a text editor
2. Find the line: "port": 7777
3. Change to a different port, e.g. "port": 8000
4. Save the file
5. Run start.bat (Windows) or ./start.sh (Linux / macOS) again

Option 3: Use the CLI with port override
-----------------------------------------
Open a terminal in the server folder and run:

  # Windows
  .venv\Scripts\python.exe -u consumer_server_cli.py serve --config commonwealth-server.json --port 8000

  # Linux / macOS
  .venv/bin/python -u consumer_server_cli.py serve --config commonwealth-server.json --port 8000

If .venv does not exist yet, run start.bat / ./start.sh once first.

Option 4: Find and kill the blocking process manually
------------------------------------------------------
Windows (Command Prompt as Administrator):
  netstat -aon | find ":7777"
  taskkill /PID <PID> /F

Linux / macOS:
  lsof -i :7777
  kill -9 <PID>

CHECKING DIFFERENT PORTS:
=========================

Common available ports:
  - 8000
  - 8080
  - 9000
  - 9999

Choose any port between 1024 and 65535 that isn't in use.

FORWARDING FOR REMOTE CONNECTIONS:
===================================

If using a non-standard port (not 7777), remember to:
1. Forward that port on your router
2. Tell remote players to connect to your_ip:port_number

================================================================================
