Closed GoogleCodeExporter closed 8 years ago
P.S.
For those who think the close isn't needed: this close makes a native call,
without having a finalized (which is a bad idea in general) this native call
will not be made therefor the resources aren't freed.
Actually there should be a try / finally around the code to make it also work
in case of problems:
/**
* Sends this packet to the EventServer
* @param adr Address of the EventServer
* @param port Port of the EventServer
* @throws IOException
*/
public void send(InetAddress adr, int port) throws IOException
{
int maxseq = getNumPackets();
DatagramSocket s = new DatagramSocket();
try {
// For each Packet in Sequence...
for(int seq=1;seq<=maxseq;seq++)
{
// Get Message and send them...
byte[] pack = getUDPMessage(seq);
DatagramPacket p = new DatagramPacket(pack, pack.length);
p.setAddress(adr);
p.setPort(port);
s.send(p);
}
} finally {
s.close();
}
}
Original comment by robin.k...@gmail.com
on 15 Apr 2011 at 2:59
This issue was closed by revision r771.
Original comment by till.ess...@googlemail.com
on 24 May 2011 at 8:29
Original issue reported on code.google.com by
robin.k...@gmail.com
on 15 Apr 2011 at 2:52Attachments: