Hi, thanks for your reply. JSON is a plain-text format, right? I would worry about the increased size of the data packet.
Is there a platform-safe way to transmit binary data? Cheers Jamie On Sun, Aug 10, 2014 at 9:54 AM, Sergey Lyubka <[email protected]> wrote: > I would rather return a JSON object that holds an array of Numbers. Reason: > independence from the platform-specific representation of floats. > > However if you'd like to send a binary blob instead, do: > > case MG_REQUEST: > if (strcmp(conn->uri, "/get_floats") == 0) { > mg_send_header(conn, "Content-Type", "application/octet-stream"); > mg_send_data(conn, float_array_pointer, size_of_float_array); > return MG_TRUE; > } > ... > > > On Sun, Aug 10, 2014 at 6:12 AM, JamieOliver <[email protected]> wrote: >> >> Hi, >> >> I have Mongoose server built in to a C++ application. The C++ application >> holds arrays of floating point numbers, and I would like to request this >> data from a Javascript page (also served by my application) using >> XMLHttpRequest, as a binary blob. How can I use Mongoose to handle and >> service this request? >> >> Thanks, >> Jamie >> >> -- >> You received this message because you are subscribed to the Google Groups >> "mongoose-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/mongoose-users. >> For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "mongoose-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/mongoose-users/gKs85nB4b-M/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/mongoose-users. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "mongoose-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mongoose-users. For more options, visit https://groups.google.com/d/optout.
