I upgraded my test clients written in Java to use the latest Java API (v1.0.4). This however broke the sending and receiving of UDP packages.
After I receive the login event I initialize the UDP channel:
Code: Select all
_smartFox.initUdp(_ip, _port);
I listen to the SFSEvent.UDP_INIT event. Once this event is received, I send the JoinRoomRequest to the server. In the UDP_INIT event I receive the following exception:
Code: Select all
244 [Thread-8] ERROR sfs2x.client.core.sockets.UDPSocketLayer - UDPSocketLayer: General error reading data from socket: org.jboss.netty.buffer.BigEndianHeapChannelBuffer cannot be cast to org.jboss.netty.buffer.TruncatedChannelBuffer
244 [Thread-8] INFO sfs2x.client.core.EventDispatcher - Dispatching event OnError to 1 listeners
244 [Thread-8] WARN sfs2x.client.bitswarm.UDPManager - Unexpected UDP I/O Error. General error reading data from socket: org.jboss.netty.buffer.BigEndianHeapChannelBuffer cannot be cast to org.jboss.netty.buffer.TruncatedChannelBuffer
java.lang.NullPointerException
at sfs2x.client.core.sockets.UDPSocketLayer.write(UDPSocketLayer.java:143)
at sfs2x.client.bitswarm.UDPManager.sendInitializationRequest(UDPManager.java:210)
at sfs2x.client.bitswarm.UDPManager.onTimeout(UDPManager.java:230)
at sfs2x.client.bitswarm.UDPManager.access$2(UDPManager.java:218)
at sfs2x.client.bitswarm.UDPManager$3.run(UDPManager.java:257)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
3225 [Timer-1] ERROR sfs2x.client.core.sockets.UDPSocketLayer - UDPSocketLayer: Error writing UDP data: null
3225 [Thread-9] ERROR sfs2x.client.core.sockets.UDPSocketLayer - UDPSocketLayer: null
3225 [Thread-9] INFO sfs2x.client.core.EventDispatcher - Dispatching event OnError to 1 listeners
3225 [Thread-9] WARN sfs2x.client.bitswarm.UDPManager - Unexpected UDP I/O Error. null
The SFSEvent.UDP_INIT event gets called multiple times as well... I tried compiling with Java SDK 1.6 and 1.7, but both gave the same result.
I'm running the clients on Mac OS X 10.7.5 and both my client (v1.0.4) as server (v2.4.0) are using the latest SmartFox code. The previous Java API I was using (v1.0.1) didn't gave this UDP errors... This API also used netty-3.2.2.Final.jar instead of netty-3.5.7.Final.jar.
Thanks
Jan
UPDATE: If I don't upgrade the Netty library to 3.5.7 the UDP seems to work... There must we something wrong with this new library integration.