Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » Flatbuffers package
Re: Flatbuffers package [message #55804 is a reply to message #55801] Tue, 15 December 2020 15:22 Go to previous messageGo to previous message
Oblivion is currently offline  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. Smile 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





[Updated on: Tue, 15 December 2020 16:25]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GLFW Package
Next Topic: Bazaar/STEM4U: Added Catenary functions
Goto Forum:
  


Current Time: Fri Apr 19 10:26:00 CEST 2024

Total time taken to generate the page: 0.04383 seconds