• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multicast Sockets

 
Vrishal Likhite
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
i would like to knw, is there any method to convert an ArrayList to byte array
or
can a DatagramPacket take an ArrayList as parameter

Please guide me to do so
i want to send an ArrayList over a multicast and receive it as it is.So for this i need a DatagramPacket.

thanx
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vrishal,

Welcome to Javaranch

We'd like you to read the Javaranch Naming Policy and change your publicly displayed name (change it here) to comply with our unique rule. Thank you.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See if you can write your ArrayList to an ObjectOutputStream built with a ByteArrayOutputStream. That will "serialize" your object into a byte array. On the other end you'd feed that array back into an ObjectInputStream.

Read the ObjectOutputStream doc carefully. There are some details that can confuse your or prevent this from working with your particular objects.
 
Vrishal Likhite
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thanx for your reply, i will try it out
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic