I use the following code snippet to send data to a web server. In this case, I do not care at all about the HTML page that the server wants to send back. The server supports other clients that need that data, so I can't eliminate the quantity of HTML that is going to come back at my Python on Raspberry Pi. What I'm seeing is that frequently the ESP-8266 server seems to hang waiting to send data back to my Python/Pi client. Like the Pi stops accepting the data until something times out. As a test, I eliminated 50% of the web page being served, and it works fine on the Pi/Python. Should I be doing something in the python code to set buffer size or issue a command to ensure the data is discarded and not kept in a socket buffer somewhere that could perhaps overflow or something that causes python/pi to stop accepting server data?
htmlString = ("/Interior, /COLOR,r="+str(dimPixelIn[0]).zfill(3)+",g="+str(dimPixelIn[1]).zfill(3)+",b="+str(dimPixelIn[2]).zfill(3))
conn = http.client.HTTPConnection(awningAddress, timeout=0.3)
try:
conn.request("GET", htmlString)
except socket.timeout as sto:
print("Error")
except http.client.HTTPException as Exc:
print("Error")
finally:
conn.close()
conn.close()