Joseph
Joseph

Reputation: 2726

What format to send data in over a socket

I am trying to develop a mobile app, that registered with a Java program through a socket connection. What is the best way to send the data (just a few String's and int's)? I am planning on doing it by just send it as a String in XML form. Is this the best way or is there another standard?

Thanks,

Upvotes: 0

Views: 1745

Answers (1)

Aravind Yarram
Aravind Yarram

Reputation: 80176

If the data is not much then better send it as a single string delimited by some character (comma or pipe etc). If there is lot of data exchange then a binary format like Protobuf or Thrift or Avro is better. Other textual options are JSON, XML, YAML.

MY choice is use delimited string as there is no much data.

Upvotes: 2

Related Questions