简体   繁体   English

我应该使用哪个端口号

[英]What port number should I use

I am building a program that will create a socket and have it try and access a outside server not on the local network. 我正在构建一个程序,该程序将创建一个套接字,并使其尝试访问不在本地网络上的外部服务器。 For example, I would like to have it accept a IP address of say google.com and then return the hostName for the google.com IP address i would be using to do the request with. 例如,我想让它接受一个说google.com的IP地址,然后返回我用来执行请求的google.com IP地址的主机名。

The second program I am going to be writing is going to be doing this 我要编写的第二个程序就是这样做

Write a stream-based echo server and a client sending messages to it, and receiving back each message in turn. 编写一个基于流的回显服务器和一个向其发送消息的客户端,然后依次接收每个消息。

For these two programs, are there a specific ports I should be using to do these specific problems? 对于这两个程序,我应该使用特定的端口来解决这些特定的问题吗?

Port numbers 0 to 1024 are reserved for privileged services and designated as well-known ports. 端口号0到1024保留用于特权服务,并指定为众所周知的端口。
take a look at this link might be helpful. 看一下这个链接可能会有所帮助。
https://www.webopedia.com/quick_ref/portnumbers.asp https://www.webopedia.com/quick_ref/portnumbers.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM