[nanomsg] Re: How to bind on a random port?

  • From: "Jason E. Aten" <j.e.aten@xxxxxxxxx>
  • To: nanomsg <nanomsg@xxxxxxxxxxxxx>
  • Date: Sat, 15 Nov 2014 23:51:09 -0800

If a port is occupied, it is unlikely to become available in the necessary
(quick) timeframe. EADDRINUSE error is the appropriate response.

On Sat, Nov 15, 2014 at 8:45 PM, Matt Howlett <matt.howlett@xxxxxxxxx>

> It should be treated as a failure to connect. The implementation
>> should try to re-connect assuming that the interface will become
>> available eventually.
> I think it would be very common for people to want an atomic way of
> checking if a port is free, binding to it if it is, and moving on if it is
> not (I want this and I notice a number of others here do too). I also think
> that in most scenarios where a port is already in use, it's likely to stay
> that way for a time period long enough that the application wanting to bind
> to it is not going to find it useful to wait for it to become free (I'm not
> an expert though and could be missing a common scenario where this
> functionality is actually useful - examples?). So based on that, I think
> the former behavior is the best, or should at least be an option.

Other related posts: