Reputation: 96716
UPDATED: By "available port" I mean: the OS can pick any available port i.e. I do not want to specify a port.
Upvotes: 5
Views: 944
Reputation: 14148
Question 1: Use port number 0
Question 2: Use acceptor.local_endpoint().port()
Upvotes: 8