Results 1 to 7 of 7
- 08-24-2008, 01:09 PM #1
Member
- Join Date
- Aug 2008
- Posts
- 1
- Rep Power
- 0
- 08-24-2008, 01:57 PM #2
Can you explain why?I can not do that.
If your communication is only String and has no binary capability, you will have to convert the floats to String and have an agreement/protocol with the server code so it knows what it is receiving and how to handle it.
Are you sure you can't sent binary?
If you send binary, the server will have to know how to reconstruct the data back into useful info.
- 08-24-2008, 06:00 PM #3
Over TCP/IP, you sent bytes. Its the rule.
It is really a bad idea to send float or int, as you need to be sure that both sides interpret the bytes and bits the same. Google big endian and little endian for examples.
Corba and other complex systems are about marshalling and unmarshalling binary things so they are understood on both ends. Of course Corba is complex and arcane itself.
Advice: move string representations. Convert to and from binary as needed.
- 08-29-2008, 12:47 PM #4
Novadays it is possible to use string-based JSON format. There are bunch of libraries for any programming language.
Ref www dot json dot org
- 08-29-2008, 08:28 PM #5
- 08-29-2008, 10:42 PM #6
Why binary ? JSON produces human-readable text stream. Advantage is that you do not need to write your own serialization/deserialization code - this is what JSON library does for some primitive types and objects.
Last edited by ProjectKaiser; 08-29-2008 at 10:52 PM.
- 08-30-2008, 03:48 AM #7
All it is doing is seralizing it for you. If you are sending an int or float, you are sending binary. As you say, JSON can marshal it for you.
But I believe its a weak design to send binary when you can simply send text messages. You can send text with two or three lines of simple Java, no libraries, no API, nothing fancy. To me, this is much better.
YMMV
Similar Threads
-
Server socket - send image to client
By Hinty in forum NetworkingReplies: 2Last Post: 03-14-2009, 07:39 AM -
Send an array via Socket
By lene in forum NetworkingReplies: 0Last Post: 04-23-2008, 04:29 PM -
String to Float
By durahman in forum New To JavaReplies: 2Last Post: 02-12-2008, 12:17 AM -
Float to String
By mew in forum New To JavaReplies: 4Last Post: 12-29-2007, 05:08 PM -
send files through socket
By bbq in forum Advanced JavaReplies: 1Last Post: 06-05-2007, 02:08 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks