I'm doing a variable-length message receive similar to this question where the length of the body of my message is specified in a header, and I async-read the body in a loop until it's all been transferred.
However, due to the network sometimes this gets a little too laggy and to keep the connection fresh I want to kill the socket and reconnect. Unfortunately, the async beginreceive seems to not really return if the data is slow and erraticly comes back at will.
What is the most appropriate way to measure the speed so I can disconnect if necessary? I think I could put a DateTime object in the async state and maybe do some calculations?
For context, this is for a wifi temperature probe I'm building with Arduino, which is sending the data in bursts, but the wifi connection is really dodgy where it's intended to be used.