I need to change the tcp buffer of photon, because the server sends the data in big chunks. I read that I have to modify the core file/firmware and upload the new firmware via cable.
But it is not clear to me, if I am running custom firmware, am I still able to upload a new sketch from web ide?
Is there any other way to increase the buffer size without using custom firmware?
I have also seen that it is possible to add subclass to a core file like this library from the web ide without using a custom firmware:
Is it possible to add a subclass (from web ide) to tcp library which is exactly the same as the core one, only difference the name and that a change number of 128 to 512?
That’s not how TCP is intended to be used. You should create a buffer as large as you need it to be for your data. Whenever you call the TCPClient read(buffer, length) method you append the data to what you’ve already received in your buffer. There is no need to modify anything in system firmware.
There’s no guarantee that data sent by one side will be received framed the same way, even if the internal buffer were large. You need to have something within your data stream that frames the data by length, by the contents of the data, closing of the connection, or timeout.
Thank you I try like that.
One more question. Is it possible to change the timeout of the tcp client?
I think it is now 5 sec, I would like to have like 500 ms.
The connection timeout for TCPClient connect is 5 seconds, I think. There’s no way to make it longer or shorter. Also, 500 milliseconds is pretty short to establish a TCP connection.
None of the other calls have a timeout.
You could use the library you initially linked to to make TCPClient connect be asynchronous so it wouldn’t matter how long it took.