I am currently trying to send realtime data using a byte array over Bluebox/HTTP using SmartfoxServer v2.7 and the Unity C# Client API v1.2.5 (Both are the newest releases). The byte array is wrapped in an SFSObject and sent using an ObjectMessageRequest or via a custom ExtensionRequest. The server-side debug output is listed below:
Code: Select all
09 Jul 2013 | 10:47:30,567 | ERROR | 27921397@qtp-15430150-7 | org.mortbay.log | | /BlueBox/BlueBox.do
java.lang.IllegalArgumentException: Unexpected null or empty byte array!
at com.smartfoxserver.v2.protocol.SFSIoHandler.onDataRead(SFSIoHandler.java:80)
at com.smartfoxserver.v2.bluebox.BlueBox.doPost(BlueBox.java:144)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)
at com.smartfoxserver.v2.bluebox.SessionFilter.doFilter(SessionFilter.java:141)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
I have verified we are NOT sending empty or null byte arrays and this post http://www.smartfoxserver.com/forums/viewtopic.php?f=20&t=15234#p64279 has led me to believe it's a problem with the base64 encoding libraries in C# vs Java. From what I can tell, when using Bluebox/HTTP the message is base64 encoded client-side and then decoded server side (As opposed to just sending raw data over sockets). If this is the case, however, can't the client side simply encode it properly before sending it to the server? Base64 encoding is a fairly simple process and although the standard C# implementation might not be the same as the Java implementation, one can be written to ensure compatibility. Is there somewhere I can override this encoding or can the client APIs be updated to allow this, or even fix this?
Any help is greatly appreciated.
Thanks,
Grant