UDP I/O Error

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

User avatar
janheuninck
Posts: 68
Joined: 23 Nov 2011, 01:35
Location: Vancouver BC, Canada

UDP I/O Error

Postby janheuninck » 23 Nov 2012, 22:03

Hi guys,

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.
User avatar
Lapo
Site Admin
Posts: 21012
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: UDP I/O Error

Postby Lapo » 27 Nov 2012, 16:46

Unfortunately we checked for all previous issues and didn't expect that new ones would be introduced.
Which seems to be the case :(

We'll run some more tests and update the release very soon. Meanwhile I think sticking with the previous Netty version is advisable.

Thanks for reporting.
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 1 guest