"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
Originally posted by David McCombs:
Thanks
So I could use ObjectOutputStream and ObjectInputStream for this, if I just send, receive primitive data types? Since they serialize the data, would this work? DataInputStream specifies Java data types. Is something like ByteArrayInputStream closer to what I need?
Originally posted by Henry Wong:
No... You can't use ObjectInputStream or ObjectOutputStream (wrapping a socket), they are Java specific -- meaning they send other data in order for reconstruction on the other side. DataInputStream should work... but to be safe I would tested it with an actual C/C++ socket client or server.
Henry
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
ObjectOutputStream does not wrap a Socket, but a OutputStream. Or am I way off here?
From the API on DataInputStream: A data input stream lets an application read primitive Java data types from an underlying input stream in a machine-independent way. An application uses a data output stream to write data that can later be read by a data input stream.
Originally posted by Henry Wong:
Unfortunately, it is not completely machine independent, if one side is not Java.... Actually, it should work for most cases, as Java uses the same byte order as Intel.
Originally posted by David McCombs:
Yes, it is binary data, but really what isn't?
Originally posted by Ernest Friedman-Hill:
Actually, Java uses the opposite byte order as Intel: Java is "big-endian" and Intel processors are "little-endian." But as I said above, Java's byte order just happens to be the same as "network byte order", the informal standard used to encode binary data for transmission across a network from C code on UNIX. Most C libraries offer functions like "hton()" and "ntoh()" for translating between host byte order and network byte order. Therefore, byte order is a non-issue if the C program uses established conventions.
You can't expect to wield supreme executive power just because
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|