I am using this python Websocket client on a RaspberryPi to send to my Tomcat server some frames using Websockets.
More specifically, I am splitting a big file (200MB) into many byte-array chunks (of some fixed size) and via a for loop, I am sending them to my server. Something like that:
for chunk in chunks:
ws.send(chunk, ABNF.OPCODE_BINARY)
The problem is that at random points, the connection closes (I assume from the client) and from then on, I only get "BrokenPipeError: [Errno 32] Broken pipe". Also, the bigger the chunk size and the noisier the Internet connection, the more probable it is for this to happen in general. For example, I never had this problem when using chunks of 512 bytes and a good internet connection, but if the chunks are 16384 bytes and I am using mobile Internet, I get it within the first few chunks. On windows, the same code works perfectly. Lastly, depending on which chunk size I use in Python, I set the same buffer-size on the server.
What could the problem be here and how could I address it?