为内部应用程序使用分配 TCP/IP 端口 [英] Assigning TCP/IP Ports for In-House Application Use

查看:39
本文介绍了为内部应用程序使用分配 TCP/IP 端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个由 Windows 服务托管的 WCF 服务,它需要侦听已知的 TCP/IP 端口.我可以在什么范围内安全地分配一个端口供我的组织使用?该端口将嵌入到服务和使用该服务的客户端的配置文件中.

I've written a WCF Service hosted by a Windows Service and it needs to listen on a known TCP/IP port. From what range can I safely allocate a port for use within my organization? That port will be embedded in the config files for the service and the clients that are consuming the service.

推荐答案

选择一个从 49152 到 65535 的端口号.

Pick a port number from 49152 through 65535.

IANA 发布当前分配的端口列表.

IANA publishes a list of currently assigned ports.

http://www.iana.org/assignments/port-numbers

动态和/或专用端口是从 49152 到 65535 的端口.这是您应该为内部应用程序选择端口的范围.当然,可以使用属于已发布列表中未分配范围之一的任何端口.但请注意,从这些未分配的范围中选择端口号并不能保证您选择的端口将来不会成为保留端口.

The Dynamic and/or Private Ports are those from 49152 through 65535. This is the range from where you SHOULD pick a port for your in-house applications. Of course any port belonging to one of the unassigned ranges on the published list can be used. But be aware that by picking a port number from those unassigned ranges there is no guarantee whatsoever that the port you choose will not be a reserved port in the future.

未分配的端口号不应该是用过的.IANA 将分配数字申请后的港口已获批准.

UNASSIGNED PORT NUMBERS SHOULD NOT BE USED. THE IANA WILL ASSIGN THE NUMBER FOR THE PORT AFTER YOUR APPLICATION HAS BEEN APPROVED.

并确保您选择的端口号是可配置的,如您所述:

And make sure that the port number you pick is configurable as you stated:

该端口将嵌入到服务的配置文件和正在消费的客户服务.

That port will be embedded in the config files for the service and the clients that are consuming the service.

如果其他 3rd 方您无法触摸的软件正在使用您的端口号,这将避免头痛.如果发生这种情况,您只需在配置文件中更改它,它就可以正常工作.

This will avoid headaches in case some other 3rd party you-cannot-touch software is using your port number. If that happens you just go ahead and change it on the configuration file and it just works.

这篇关于为内部应用程序使用分配 TCP/IP 端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆