How should one go about choosing a default TCP/IP

2019-01-16 17:32发布

When developing an app that will listen on a TCP/IP port, how should one go about selecting a default port? Assume that this app will be installed on many computers, and that avoiding port conflicts is desired.

12条回答
对你真心纯属浪费
2楼-- · 2019-01-16 17:50

Well, you can reference some commonly used port numbers here and try not to use anyone else's.

If by "open to the public at large" you mean you're opening ports on your own systems, I'd have a chat with your system administrators about which ports they feel comfortable with doing that with.

查看更多
劳资没心,怎么记你
3楼-- · 2019-01-16 17:51

Choose a number that is not very common

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-01-16 17:54

If this is for an application that you expect to be used widely, then register a number here so no-one else uses it.

Otherwise, just pick an unused one randomly.

The problem with using one in the dynamic range is that it may not be available because it may be being used for a dynamic port number.

查看更多
手持菜刀,她持情操
5楼-- · 2019-01-16 17:55

If by widely-used, you mean you want to protect against other people using it in the future, you can apply to have it marked as reserved for your app by IANA here

查看更多
放我归山
6楼-- · 2019-01-16 18:01

Go here and pick a port with the description Unassigned

查看更多
祖国的老花朵
7楼-- · 2019-01-16 18:01

You probably want to avoid using any ports from this list (Wikipedia).

I would just pick one, and once the app is used by the masses, the port number will become recognized and included in such lists.

查看更多
登录 后发表回答