Home » Developing U++ » UppHub » Flatbuffers package
Re: Flatbuffers package [message #55804 is a reply to message #55801] |
Tue, 15 December 2020 15:22 |
Oblivion
Messages: 1092 Registered: August 2007
|
Senior Contributor |
|
|
Quote:, I guess adding '\n' to every packet of data is ugly
Ah, I didn't mean that. What I was trying to say is that the socket examples are different then yours, and it is not suprising that you've encountered difficulties.
Since this is going to be a simple example why don't you just send the size of the data to be transferred first?
Let the other side fetch that first, and then call Get() again with the size and timeout in 30 secs.
Example (server side):
String data;
dword len = data.GetLength();
if(socket.Put(&len, sizeof(dword))
socket.Timeout(30000).Put(~data, len);
Same thing goes for the client side. First fetch the size, then use it to fetch the data.
P.s: And if you are sending binary data over the network, it is in general a good practice to convert it to base64 encoding).
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Tue, 15 December 2020 16:25] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Apr 19 10:26:00 CEST 2024
Total time taken to generate the page: 0.04383 seconds
|