I have the problem i using UDP connection to send 3 messages to the computer2, it can only get the last messages only in the computer 2
String service = "deposit"; //send service
byteSend = service.getBytes();
sendPacket.setData(byteSend);
sendPacket.setAddress(destAdd);
sendPacket.setPort(destPort);
otherBranch.send(sendPacket);
byteSend1 = accNo.getBytes(); //send accNo
sendPacket.setData(byteSend1);
sendPacket.setAddress(destAdd);
sendPacket.setPort(destPort);
otherBranch.send(sendPacket);
byteSend2 = depositAmount.getBytes(); //send depositAmount
sendPacket.setData(byteSend2);
sendPacket.setAddress(destAdd);
sendPacket.setPort(destPort);
otherBranch.send(sendPacket);
after that the computer2 have this code to receive:
myServer.receive(packetReceive);
clientMessage = new String(packetReceive.getData(),0,packetReceive.getLength());
System.out.println("Service: "+clientMessage);
myServer.receive(packetReceive);
accNo = new String(packetReceive.getData(),0,packetReceive.getLength());
System.out.println("accNo: "+accNo);
myServer.receive(packetReceive);
depositAmount = new String(packetReceive.getData(),0,packetReceive.getLength());
System.out.println("depositAmount: "+depositAmount);
How come the output only can get my last value which is depositAmount only?