12 Nov
2007
12 Nov
'07
7:11 p.m.
Hi, Is it possible to make a LaunchAgent listen on the first free port rather than a specific one? I'm trying to forward an HTTP connection on demand (over SSH), but rather than choose a specific local port I'd rather just choose a free one and then advertise it using Bonjour. So I also need to know what the chosen port was and pass it to dns-sd. A related question: is it possible (without writing to /etc/services) to make LaunchAgent listen on a port decided dynamically? i.e. would it be possible to use NAT-PMP to forward an external port to the first available local port, and then have a LaunchAgent listen on that port? Thanks, Hamish