Any help would be greatly appreciated!
Marc Pound
mpo...@astro.umd.edu
The relevent code on the sender side:
try {
byteStream = new ByteArrayOutputStream(BUFSIZE);
hostAddress =
InetAddress.getByName(hostName);
gzo=new GZIPOutputStream(byteStream);
os = new ObjectOutputStream(gzo);
os.writeObject(o);
os.flush();
dsock = new DatagramSocket(desPort,hostAddress);
DatagramPacket packet = new DatagramPacket(
sendBuf, sendBuf.length, hostAddress, desPort);
dsock.send(packet);
os.close();
} catch(Exception e) {
e.printStackTrace();
System.exit(0);
}
On the receiver side:
try {
recvBuf = new byte[BUFSIZE];
packet = new DatagramPacket(recvBuf, recvBuf.length);
byteStream = new ByteArrayInputStream(recvBuf);
gzi = new GZIPInputStream(byteStream);
is = new ObjectInputStream(gzi);
Object o = is.readObject();
is.close();
} catch (Exception e)
{
System.err.println("Exception: " + e);
e.printStackTrace();
}
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet