[R] Writing a Long across the network?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Dec 12 07:18:19 CET 2008
On Fri, 12 Dec 2008, Saptarshi Guha wrote:
> I have to write single Long to a server written in java. The server
> passes the input as
> in.readLong() // it expects to receive 8 bytes
> In Python, i can do it by sending struct.pack( "!q", value)
> However, I have tried this
> writeBin(length(x),con=conn,endian="big") #conn opened in binary
> But the response on the server side is wrong, eg. 1 is received as
> How do I then write long across the network from R?
Tell writeBin() the 'size' you want: see its help page.
> Thank you
> Saptarshi Guha | saptarshi.guha at gmail.com | http://www.stat.purdue.edu/~sguha
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help