Best practices when writing out large buffer using TCPClient?

Hi @dustpuppy,

I’ve had good luck with the code here for sending bulk TCP https://www.hackster.io/middleca/sending-sound-over-the-internet-f097b4 . I think by virtue of that app I’m only sending 1024 bytes every 100 ms or so.

My guess is that the actual TCP TX/RX buffer on the photon is probably only 1-2k, so it might need a few milliseconds to talk to your router and get the packet handed off. So a short delay between packets or if you get a failed send would probably help with bulk transfers. For the app I linked, I keep a running buffer, and then chunk it off into a transmit buffer. I’m working on another that uses a circular buffer (easier to read / use).

While I was playing with finding max TX/RX speed, I was able to get my photon to send 100KB/s. So if you’re sending 1k packets, that would be sending 100 packets a second, so maybe a delay(10); ?

I hope that helps!

Thanks,
David