cloning DatagramPackets

I have a UDP server implemented. Everytime it gets a packet, it spawns a new thread to handle that client's request and then goes back to listen for more client requests

serverSocket =new DatagramSocket(Global.getRenameServerPort());

byte[] receiveData =newbyte[MESSAGESIZE];

DatagramPacket receivePacket =new DatagramPacket(receiveData, receiveData.length);

DatagramPacket receivePacketClone;

while(true)

{

System.out.println("Rename Server started\n");

serverSocket.receive(receivePacket);// block waiting for request from client

if(DEBUG == 2)

System.out.println("Received a packet from the client");

receivePacketClone = (DatagramPacket)receivePacket.clone();

RenameServerInstance request =new RenameServerInstance(receivePacketClone, DEBUG);

/* Create a new thread that will handle this request */

Thread t =new Thread(request);

/* Start the new thread */

t.start();// throws IllegalThreadStateException

/* Go back and listen for new incoming packets */

}//end while

}

catch(Exception e)

{

System.out.println(e);

}

Should I need to clone the receivePacket before I pass it to RenameServerInstance? If so, how should i do it? I tried calling clone() method on receivePacket but it doesnt work. The error that comes is

D:\DS\DIBSSourceCode\MainDIBS\RenameServer.java:116: clone() has protected access in java.lang.Object

receivePacketClone = (DatagramPacket)receivePacket.clone();

Any help is appreciated

[2314 byte] By [aybhavea] at [2007-11-27 0:39:04]
# 1
Not sure if u already googled this one : http://www.javaworld.com/javaworld/jw-08-2001/jw-0803-java101guide.htmltells you how to call clone().
veeseekaya at 2007-7-11 22:50:25 > top of Java-index,Core,Core APIs...
# 2
I wouldn't use clone(), I would use a new DatagramPacket per receive.
ejpa at 2007-7-11 22:50:25 > top of Java-index,Core,Core APIs...