jmrapp1 / NitroNet

A networking library used to simplify the development of applications that require some form of networking. It is multiplatform, supports UDP and TCP, encryption of packets, packet corruption handling, packet streaming, SQL support, and much more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Complex send object

Mierzmit opened this issue · comments

I keep getting this exception(not always) when trying to send bigger (but still pretty small 1.2mb< ) files from server to each connected client using complex send object.

java.lang.ArrayIndexOutOfBoundsException
at com.jmr.wrapper.common.complex.ReceivedComplexObject.formObject(ReceivedComplexObject.java:77)
at com.jmr.wrapper.common.complex.ComplexManager.handlePiece(ComplexManager.java:57)
at com.jmr.wrapper.common.utils.PacketUtils.handleComplexPiece(PacketUtils.java:211)
at com.jmr.wrapper.client.threads.ClientTcpReadThread.run(ClientTcpReadThread.java:67)

I using fixed number of 20 splits as I won't have any bigger files.
This is code I using:

for (Connection c : ConnectionManager.getInstance().getConnections()) {
c.sendComplexObjectTcp(packet, 20);
}

Even when I split it and send only to one client it give exception.

commented

The problem has been fixed. It seems that it was an issue with some byte arrays being converted to int's incorrectly. Sorry for the delay. Should be working now.