A bind with a port of zero will bind you to a free port. Is this portable? [closed]
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 9 months ago . I want my program to bind to a free port. Google told me that a bind with port=0 will do that, but I haven't found if this is guaranteed to work on any system (Windows/Linux in particular). Can someone link a doc that say that? 回答1: It's universal as far as I know, but I can't find any text in the standards