If you’re comfortable with Python, you can write a quick script for a random tcp port generator. Here’s a basic one:
```python
import random
import socket
def get_random_port():
while True:
port = random.randint(1024, 65535)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if sock.connect_ex(('localhost', port)) != 0:
return port
```
This checks if the port is in use before returning it. Super lightweight and customizable.
```python
import random
import socket
def get_random_port():
while True:
port = random.randint(1024, 65535)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if sock.connect_ex(('localhost', port)) != 0:
return port
```
This checks if the port is in use before returning it. Super lightweight and customizable.
