0
votes

I am studying the performance of MQTT protocol. I am using Raspberry Pi as the MQTT broker, and a PC as a client both connected in the same LAN. The PC sends a message to the broker, and when the broker receives it then it publishes back a publish.single. When I try to send 10,000 publish message per minute with qos=2, I get the following error message at the client side after ~8163 messages:

error: [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted

I tried the same for qos=0 and qos=1, it worked without getting the same error. What's the problem?

1

1 Answers

2
votes

This most likely because you have exhausted the number available local ports on the client machine because you have so many messages inflight.

QOS 2 messages have a lot more overhead (they require confirmation in both directions).

It's possibly being made worse by using the publish.single method because this will be creating and tearing down a full connection to the broker for each message, if you create a persistent connection and reuse it things will probably flow better.