22

Suppose that several machines are interacting together using python's zeroMQ client.

These messages are naturally formatted as strings.

Is there a limit to the length of a message (string)?

Benyamin Jafari
  • 27,880
  • 26
  • 135
  • 150
user3262424
  • 7,223
  • 16
  • 54
  • 84

4 Answers4

21

There is no limit to the size of messages being sent however small messages are handled differently than large messages (see here).

The max size of a small messages is defined in the source code at 30 bytes (see here, look for ZMQ_MAX_VSM_SIZE).

kwo
  • 1,834
  • 1
  • 15
  • 9
5

There is the socket option ZMQ_MAXMSGSIZE which causes a peer sending an oversized message to be disconnected, but the default is "no limit".

Rob Agar
  • 12,337
  • 5
  • 48
  • 63
  • 1
    Does not answer the question. – meawoppl Jan 26 '16 at 06:56
  • @meawoppl `but the default is "no limit"` does answer the question! IMHO this here is currently the most helpful answer (if you do not look in the comments of the accepted answer). – Tino Jun 08 '21 at 00:37
2

No limit

As for small size messages transmitted within zmq_msg_t structures, their limit is 29 bytes (for zmq version 3.2.2)

"max_vsm_size = 29," quoted from https://github.com/zeromq/libzmq/blob/master/src/msg.hpp

cloudcell
  • 487
  • 6
  • 6
2

Some socket types support up to 2^64, but some less than 2^31.

You should build a protocol that keeps chunks below that size anyway, but this is the real answer.

https://github.com/zeromq/libzmq/issues/1332

meawoppl
  • 2,714
  • 1
  • 23
  • 30