Max Speed of TCP Data (and proper coding methods)

Summary

  • Have a 1 second delay before trying to connect
  • Wait at least 80 ms between sending signals
  • never use client.print – only write your entire buffer in a single client.write(buffer, len) call
  • always call Spark.diconnect() for doing TCP connection code.
  • send a keep-alive in the header (see my code examples)

This will all be implemented soon.

some comments
On a separate but related issue, it is apparently necessary to include about a one second delay (I don’t know if that is the exact amount, but 500ms was not enough) before the spark attempts to connect with. Without it, it will never connect (crazy as that may sound)

Oddly enough, this problem only exists on my work Windows server – with linux I communicated just fine (although it always took a while to actually send data).

I want people to know this while they try to debug their connections – a delay could fix your problem!