Trying to find an available port for starting a server

352405 pts.
Tags:
Networking
Port
I'm looking to start a server that listens to a port. I can easily specify port explicitly and it's working. But I'm looking find a port in an automatic way. What port numbers should I search for? (I've used 12345, 12346 and 12347) How can I see if a port is actually being used by another software?

Answer Wiki

Thanks. We'll let you know when a new response is added.

You can use any port you want, as long as the OS or another service is not using it. In Windows, you can run netstat -an|more at the command prompt to see which ports are currently in use.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Brijesh
    The standard MS Windows of netstat is used to get a listing of listening ports:
    netstat -a -n
    
    9,820 pointsBadges:
    report
  • Brijesh
    The standard MS Windows netstat is used to get a listing of listening services:

      netstat -a | find "LISTENING"

    9,820 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following