Transmitting Composite Data Types Over Java Server Socket?

1 view (last 30 days)
I am using java.net.ServerSocket to create a TCP/IP connection between more than two MATLAB sessions existing on multiple computers on a network. I cannot transmit composite data, like a MATLAB structure, over this connection.
I have investigated two techniques: 1.) Using functions to systematically convert the structure into a primitive array, like a uint8 array or character string, and back again; and 2.) saving the desired workspace variables to a MAT file, then using fread and fwrite flagged to convert to and from a primitive array. The second technique runs significantly faster than the first, but I don’t like that I have to access a hard drive to create the temp.mat files.
I am looking for an alternative. Is there a way to quickly retrieve the primitive data that composes a composite data type? I’m not familiar with MEX functions, but I suspect I might be able to put in a composite input and get a primitive output, but I don’t know if I could reverse it. Does anyone have a constructive suggestion as to which course of action I should pursue first? Thank you.

Answers (1)

Walter Roberson
Walter Roberson on 22 Aug 2011
You might be able to leverage something out of http://www.mathworks.com/help/techdoc/ref/putworkspacedata.html ... I don't know.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!