I need to pass an int array from the server to the client many times.
The first time that I send the array, everything works perfectly, but when I send it the second time or third etc. it arrives to the client as the exact same array that I've sent the first time.
If I send first time: 1, 0, 0, 0
The client will receive: 1, 0, 0, 0
And no matter what I send afterwards, my client will always continue receiving 1, 0, 0, 0 forever.
You might think that there is a problem with my sockets, streams etc. but I doubt it because I tried sending other data that isn't arrays and it worked perfectly.
The way I fixed my problem was by turning the int to Integer. Now it all works, but I just don't understand how that is possible. Can somebody explain?
Here is the code of my connection class which is responsible for accepting packets and sending them.
By the way, I also checked if what I send is changing and if what I receive is really the same and it really is. As I said just turning the array from int to Integer fixed the problem, but I can't get why.
Thanks for help a lot!