Sorry, I can't use ASCII text as communication method, since I plan to send large quantities of data at high speed rates, I need to optimize it as much as possible. Compared to streaming bytes, ASCII is inefficient up to a several orders of magnitude.

Is there a method for correct endianness in Pure Data, like these C functions:

ntohs()--"Network to Host Short"
ntohl()--"Network to Host Long"

On 09/3/13 5:15 PM, Martin Peach wrote:
It's probably safer to get the server to send the numbers as ASCII text, to avoid disagreements about endianness and floating-point representation. Then, to extract the numbers, you could use [moocow/bytes2any] or make a custom parser using [pdlua].

Martin


On 2013-03-09 10:55, Petar Jercic wrote:
Apparently [netclient] on the Pure Data side cannot receive nothing else
than ; delimited messages.
So the solution for the problem:
*My question is, is there a way to send something other than string
message to Pure Data, like byte-stream or serialized number stream? Can
Pure Data receive such messages?*

The solution is to use [tcpclient], it can receive byte-stream data.

Now I have another problem regarding the data read, on how to convert it
back to usable numbers.

 From my UNIX server I am sending a structure

typedef struct {
     int     var_code;
     int    sample_time;
     int     hr;
     float    hs;
} phy_data;

Sample data might be 2 1000000 51 2000.56

When received and printed  in Pure Data I get output like this:

 >>>: 2 0 0 0 104 34 9 0 51 0 0 0 235 50 48 69

You can notice number 2 and number 51 clearly, I guess the others are
correct as well. Might be some network inversion of LSB/MSB.

*How can I get these numbers back to a usable format and get them in
separate variables?

*//Petar*
*


_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list




_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to