简体   繁体   中英

error: [Errno 10048] : when sending 10,000 publish messages from client to broker (python,MQTT, raspberry pi)

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM