File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Multicast Sockets" Watch "Multicast Sockets" New topic

Multicast Sockets

Vrishal Likhite

Joined: Nov 21, 2005
Posts: 18
i would like to knw, is there any method to convert an ArrayList to byte array
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.

Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271

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

Joined: Nov 21, 2005
Posts: 18
Hey thanx for your reply, i will try it out
I agree. Here's the link:
subject: Multicast Sockets
It's not a secret anymore!