This article is a mirror article of machine translation, please click here to jump to the original article.

View: 2555|Reply: 1

[Source] .NET/C# checks if a TCP port is available

[Copy link]
Posted on 1/27/2024 12:03:20 PM | | | |
Requirements: The program needs to listen to a TCP port that can accept connections from different clients.


When you create a TCP/IP server connection on a Windows-based platform, you can specify the port number. It seems unlikely that both applications executing at the same time will try to open the same port number, in fact it happens quite often. It is recommended to determine if a port is already in use before attempting to initiate a server connection that listens to that port.

The source code is as follows:

The renderings are as follows:






Previous:ZEBRA zebra printer information
Next:Explore topics in the .Net Reactive Responsive Extension
 Landlord| Posted on 8/14/2025 8:36:51 AM |
A random TCP port is opened
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com