wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes Multicast Sockets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Multicast Sockets" Watch "Multicast Sockets" New topic
Author

Multicast Sockets

Vrishal Likhite
Greenhorn

Joined: Nov 21, 2005
Posts: 18
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

Joined: Dec 20, 2001
Posts: 3271
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.


SCJP Tipline, etc.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Vrishal Likhite
Greenhorn

Joined: Nov 21, 2005
Posts: 18
Hey thanx for your reply, i will try it out
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multicast Sockets