• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending an Objetc[] - DatagramSocket  RSS feed

 
Gustavo Berndorfer Goldhardt
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

It is possible send a serialized array of objects (Object[]) through DatagramSocket? If yes, how can I do it?

Thanks a lot!
 
Rob Spoor
Sheriff
Posts: 20898
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I've said here, UDP / DatagramSocket is not a good option for this.

Again, it may still be possible with a lot of luck, by writing the Object[] to a ByteArrayOutputStream wrapped in an ObjectOutputStream, then sending the byte array (in chunks, probably). On the other side you use a ByteArrayInputStream wrapped in an ObjectInputStream to retrieve the Object[]. You'll need to put all chunks back into one large array first.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!