关于巴特在
NAT router blocking JMS messages年遇到的问题
我试图找到客户端收到openJMS消息的端口号.在网上搜索年龄后,我只能找到有关服务器端口的信息,客户端上没有任何内容.这是用于tcp连接.
如果有人能指出我正确的方向,我将非常感激.
谢谢!
最佳答案 通常,每个新连接的客户端端口号都不同.我找不到OpenJMS客户端在与服务器通信时使用特定端口号的证据.以下是一些解释.
When a client process first contacts a server process, it may use a
well-known port number to initiate communication. Well-known port
numbers are assigned to particular services throughout the Internet,
by IANA, the Internet Assigned Numbers Authority. The well-known port
numbers are in the range 0 through 1023.Well-known ports are used only to establish communication between
client and server processes. When this has been done, the server
allocates an ephemeral port number for subsequent use. Ephemeral port
numbers are unique port numbers which are assigned dynamically when
processes start communicating. They are released when communication is
complete.
> TCP/IP Client (Ephemeral) Ports and Client/Server Application Port Use
In contrast, servers respond to clients; they do not initiate contact
with them. Thus, the client doesn’t need to use a reserved port
number. In fact, this is really an understatement: a server shouldn’t
use a well-known or registered port number to send responses back to
clients. The reason is that it is possible for a particular device to
have both client and server software of the same protocol running on
the same machine. If a server received an HTTP request on port 80 of
its machine and sent the reply back to port 80 on the client machine,
it would be sending the reply to the client machine’s HTTP server
process (if present) and not the client process that sent the initial
request.To know where to send the reply, the server must know the port number
the client is using. This is supplied by the client as the Source Port
in the request, and then used by the server as the destination port to
send the reply. Client processes don’t use well-known or registered
ports. Instead, each client process is assigned a temporary port
number for its use. This is commonly called an ephemeral port number.
>关于另一个问题的类似答案:How to decide on port number between client and server communication on internet:
Also, a client can connect to many servers on the same port. When the
clients connect, they will use a random port on there end.Only the server needs to worry about using a free port, and the
clients need to know what this port is else they will not be able to
connect to your server.
其他可能的帮助: