Re: Listening in a specified range of ports
Re: Listening in a specified range of ports
- Subject: Re: Listening in a specified range of ports
- From: Quinn <email@hidden>
- Date: Tue, 13 Aug 2002 10:32:47 +0100
At 11:58 +0200 12/8/02, Alessandro Volz wrote:
Let's say my user is firewalled, being redirected incoming
connection requests in a specified range (1024..4096 as example, or
just port 114), so that it still can listen, thats it, in that range
of ports. This is settable on some ADSL modems/routers, that's why
this is interesting.
So i want OT to, when OTBinding an endpoint, assign one port in the
specified range to the endpoint: the code i previously posted showed
how I ask OT to Bind to a random local port, and i'm asking you how
i should modify that to make OTBind work like picking a free local
port in that famous specified range...
Well, there are two ways I can see of doing this.
1. Grab IPNetTuner, which lets you change various properties of OT,
including where OT grabs its anonymous ports from. This will affect
all software on the Mac.
<
http://www.sustworks.com/site/prod_ottuner.html>
2. If you just want to do this for your code, you can simply pick a
random port in the range, bind to it (with the address set to
kOTAnyInetAddress), and if that returns an kOTAddressBusyErr, pick
another random port, bind to it, and so on, until you've found a port
or you've tried all of those in the range.
Needless to say this isn't very efficient, but it's probably the best
you can do given your unusual requirements.
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.