I have written a code which used to send data that was saved in my mysql database, through ethernet using UDP protocol, everything worked fine until i sent fewer data(25 rows), when i started sending data in huge amount(100 rows) it used to display Java Result: -1073740791 and would stop the running code. can somebody help e please.
try {
InetAddress src = null;
InetAddress dest = null;
if (pack instanceof IPPacket) {
IPPacket ipp = (IPPacket) pack;
src = ipp.dst_ip;
dest = ipp.src_ip;
}
System.out.println("src ip: " + src);
System.out.println("dest ip: " + dest);
EthernetPacket etherSrc = ((EthernetPacket) pack.datalink);
byte[] gwmac = null;
gwmac = etherSrc.src_mac;
System.out.println("dest mac : " + gwmac);
JpcapSender sender = JpcapSender.openDevice(devices[index]);
UDPPacket sendPacket = new UDPPacket(55000, 61000);
sendPacket.setIPv4Parameter(0, false, false, false, 0, false, false, false, 0, 1010101, 100, IPPacket.IPPROTO_UDP,
src, dest);
String outData = sendData(pack);
sendPacket.data = outData.getBytes();
System.out.println("string sent =" + sendPacket.data);
EthernetPacket ether = new EthernetPacket(); //get ethernet packet
ether.frametype = EthernetPacket.ETHERTYPE_IP; //set frame type as IP
ether.src_mac = devices[index].mac_address;
System.out.println("source MAC address =" + ether.src_mac);
ether.dst_mac = gwmac;
System.out.println("destination MAC address =" + gwmac);
for (byte b : ether.dst_mac) {
System.out.print(Integer.toHexString(b & 0xff) + ":");
System.out.println();
}
sendPacket.datalink = ether;
sender.sendPacket(sendPacket); //error comes at this line
} catch (UnknownHostException ex) {
Logger.getLogger(Net.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, ex);
}
sendPacket holds the data that is been extracted from the mysql database