LoginSignup
2
1

More than 3 years have passed since last update.

OSError: [Errno 40] Message too longが出たときの対処

Posted at

UDP通信をしているときに

OSError: [Errno 40] Message too long

というエラーがでて困ってしまったので対処法を忘れないように載せておきます。

対処

sysctl -a | grep udp.maxdgram

を実行すると,udp通信の際のパケットの容量が表示されます。

net.inet.udp.maxdgram: 9216

この値を変更してあげることで解決しました。

sudo sysctl -w net.inet.udp.maxdgram=65536

うまくいかなかったところ

実はこのとき,Pythonで大きさ65536のデータを送信してもまだエラーが出たので,少しデータを小さくして送信しました。なにか余分な情報が付加されて送信されているのでしょうか...
なにかわかりそうな方がいたら教えてもらえると嬉しいです。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1