zmq4 icon indicating copy to clipboard operation
zmq4 copied to clipboard

Socket can only Listen to one endpoint

Open guidog opened this issue 4 years ago • 3 comments

Hi!

Discovered while working on #85.

The socket struct does only allow for one listener per socket.

IMHO this is against the ZeroMQ idea. Would classify that as a bug.

Could use that as the reason to revamp the whole listen/connect/reconnect mechanic.

Relates to #40.

Cheers Guido

guidog avatar Nov 01 '20 10:11 guidog

SGTM. (although I am not sure this couldn't be implemented as an orthogonal component, like io.MultiReader, but this could indeed be more efficiently implemented within socket...)

sbinet avatar Nov 06 '20 14:11 sbinet

  1. Would start with socket.accept taking the listener as parameter.
  2. Make accept Close the listener on exit.
  3. Break the listen loop on errors on the listener (to prevent endless Cpu hogging loop).

These steps wouldn't need changes on the socket structure.

Next would be to come up with an idea on how to track the active listeners. This would allow to un-listen specific endpoints.

guidog avatar Nov 07 '20 08:11 guidog

SGTM.

sbinet avatar Nov 07 '20 10:11 sbinet