开发者

How to pick a port number?

开发者 https://www.devze.com 2023-03-02 18:01 出处:网络
I am trying to develop an iPhone p2p application. I am going to use a centralized server and users will u开发者_JS百科pdate their IP addresses to the server. I want to set up a connection between use

I am trying to develop an iPhone p2p application.

I am going to use a centralized server and users will u开发者_JS百科pdate their IP addresses to the server. I want to set up a connection between users, regardless of what network users belong to.

I was going to use a fixed port number and someone pointed out that a router, if the user connected via Wi-Fi, might block the port number I manually set up.

How do I fix this problem?


You might look into NAT traversal strategies like UDP hole punching, which is one method of supporting p2p communication when the endpoints may not have routeable IP addresses (for example, if they're behind NAT routers). Philip makes a good point in his answer, though: it's possible to configure routers and firewalls to deny p2p traffic, so for maximum flexibility you might want the ability to fall back to a client-server mode (using your server as an intermediary).


You can't fix this problem. The administrator of a "router" is free to block arbitrary port numbers.

0

精彩评论

暂无评论...
验证码 换一张
取 消