I currently have a java program that requires quick communication between the client and server. I have decided to use UDP, after trying out TCP and RMI, which both were too slow for my purposes.
I have multiple ArrayLists that are stored in one ArrayList, which is then sent to the server. This method has worked fine in TCP and RMI, but it is required in UDP that this is changed to bytes.
ArrayList<Object> array = new ArrayList<Object>();
array.add(arrayList1);
array.add(arrayList2);
array.add(arrayList3);
array.add(arrayList4);
array.add(arrayList5);
array.add(arrayList6);
// Convert the ArrayList to bytes, then send to client
Each of the ArrayLists being added to the ArrayList that is being sent to the client contains objects and each ArrayList contains different types of objects. Most of the ArrayLists contain objects resulting from classes that I have created, but I do not think it is necessary to show them.
I have searched the internet for the answer to converting an ArrayList of ArrayLists to a byte, but the .getBytes() method does not work on the ArrayLists or the objects inside them.
If you need more examples of the code I am using, feel free to ask. The code above is not my real code(as numbering ArrayLists would be extremely confusing), but it is an accurate representation of what I am trying to achieve.
Thank you.