Hi, all,

Many thanks for your suggestions/infos!

For my previous question: "how to get the size of R object, so that the C++
process can know exact bytes to read, and receive the R objectvia socket
connection", for now, I used the following way to achieve this. It worked
for me. Pls feel free to let me know if there are anything I missed.

I sent the length of serialized raw vector into socket connection first,
and then send the raw vector into connection:
> a <- list(1,2,3)
> a_serial <- serialize(a, NULL)
> a_length <- length(a_serial)
> a_length
[1] 70
> writeBin(as.integer(a_length), connection, endian="big")
> serialize(a, connection)

In C++ process, I receive one int variable first to get the length, and
then read <length> bytes from the connection.

It worked for me now.

BTW, if there is anything I against the posting rule, pls feel free to
correct me.

=====================

Rong "Jessica", Li
Platform Symphony TET, CSTL, IBM Systems &Technology Group, Development
Email:rong...@cn.ibm.com
        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to