Re: How do I choose a network port for listening/broadcasting? (REPOST)
Re: How do I choose a network port for listening/broadcasting? (REPOST)
- Subject: Re: How do I choose a network port for listening/broadcasting? (REPOST)
- From: Brent Gulanowski <email@hidden>
- Date: Thu, 13 May 2004 12:23:57 -0400
I'll take a stab at this...
On May 12, 2004, at 9:03 PM, Daniel Waylonis wrote:
>
Hi,
>
>
I posted the following in the mac-games-dev list, but I didn't get a
>
response:
>
>
I'd like to add the ability to connect to another machine over IP in my
>
application (in addition to Rendezvous discovery in my local network).
Me, too, actually.
>
>
It's not clear to me how to choose the TCP/UDP port number that my
>
application will use. I looked on IANA at the list of known port
>
numbers (http://www.iana.org/assignments/port-numbers). That document
>
said that ports 49152 - 65535 are dynamic and/or private ports.
>
However, what happens if I pick one (50000) and some other application
>
is using it? I suppose that I could have a list of 5-10 ports in that
>
range that my program will check once given the IP address of the
>
target machine.
You could do that, but there seems to be little worry. Most games don't
have a problem and they aren't always registered (here's a few:
<
http://www.u.arizona.edu/~trw/games/ports.htm> -- there are more,
however). Just choose anything above 1023 and register it. And having
multiple port options means you have to scan them all.
>
>
Also, what about firewalls and NAT?
Yes, what about those. Well some kind of incoming port has to be open,
so you can always initiate a connection over one which is available,
like http, and then switch to whatever you want to use after. I haven't
figured out what happens if both nodes are behind blocking firewalls,
however. As for NAT, the user will have to configure their NAT to
redirect the traffic, for the port you have chosen, to the correct
machine (a "virtual server").
But it really depends on the traffic flow. Clients behind a NAT can
initiate traffic with visible servers, so the problem is trying to
advertise a service from inside a NAT or behind a firewall. Well,
usually you don't want to do the latter. Even cheap home routers offer
DMZ support now, anyway, so someone who wants to run a service behind a
NAT can always set that up. If you want something that works without
configuration on the WAN between two hidden clients, you need some kind
of facilitator or intermediary exposed on the public Internet.
As far as automated connection through firewalls, I have not worked out
all of the implications, like what counts as deliberate circumvention
versus just a workaround for user convenience.
--
Brent Gulanowski email@hidden
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.