FAQ
Use Port 0. The operating system will then assign you a free one
automatically.
You can see which one was chosen through Listener.Address(), after it has
opened.
On Tuesday, May 14, 2013 9:53:44 AM UTC+2, dlin wrote:

I want to write a test program to test web server which register a free
port.

But, when we Listening, we must provide a parameter e.g :6060.

Because port 6060 is occupied by godoc sometimes, I wish my
server_test.go will run as soon as possible.
So, I require to assign a free port number.

Any suggestion?
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 6 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMay 14, '13 at 7:53a
activeMay 14, '13 at 11:05a
posts6
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase