Re: Send a RealArray over a Socket
vaishali chattopadhyay <greatbonny-/[email protected]> Wed, 22 Aug 2007 21:00:20 -0700 (PDT)
| Newsgroups | gmane.comp.lang.sml.smlnj |
|---|---|
| Message-ID | <[email protected]> |
Hi everyone, Thanks for all your suggestions. I finally ended up adding c-functions to the smlnj runtime to send and receive a Real64Array. I also added appropriate wrapper functions to the smlnj basis library to send and receive real array slices. This seems to work fine for me. If interested in a patch, I will be glad to share it. Regards Vaishali --- Matthew Fluet <[email protected]> wrote: > On Thu, 16 Aug 2007, Gergely Buday wrote: > >> I am trying to send a RealArray over a socket. > >> However, I noticed that the sendArray function > works > >> only with Word8Arrays. What is the best way to > send a > >> large RealArray efficiently over a socket? > >> > >> Do I have to convert the RealArray into a > Word8Array? > > > > Dear Vaishali, > > > > as John wrote you have to have a Word8Array to > send it over a socket. > > But an option would be to write a wrapper > structure around Word8Array > > that implements a part of RealArray's signature. > It's not clear what > > do you use to compute the RealArray but in an > optimist's view it's > > enough to implement sub, update and tabulate. And > a simple function > > that exports the underlying Word8Array that you > will use only to send > > it over a socket. What do you think of this? > > The structures that match the PACK_REAL signature > are provided by the > Basis Library as a convenient way of packing real > values into a > Word8Array: > http://www.standardml.org/Basis/pack-float.html > > As Gergely suggests, if you can organize your > computation so that you > write the elements of the "final RealArray" directly > into a Word8Array > via PackRealLittle.update, then you won't have any > additional copying. > > -Matthew > > ____________________________________________________________________________________ Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/