1

I am currently writing java client and server chat application using socket programming in which I am exchanging data using JSON objects.When I try to store byte array containing encrypted data, and sends udp data packet from client to server, byte data gets corrupted.

As per few posts, JSON object cannot handle byte array data. So is there any way by which I can send multiple encrypted data byte arrays using UDP packet from client to server?

Robin Green
  • 32,079
  • 16
  • 104
  • 187
Frankenstein
  • 43
  • 1
  • 1
  • 8

1 Answers1

1

As noted in the comments, you can encode binary data as text, using the very old and well-known technique of Base64 encoding. In Java you can do this using javax.xml.bind.DatatypeConverter.

Robin Green
  • 32,079
  • 16
  • 104
  • 187