Page 1 of 1

Can't send request.

Posted: 09 Jul 2012, 11:10
by Birch
Hello guys!

I am trying to send a quite large object (approximately 229 KB) from unity to smartfox, but i can't get it to work. I want to send information about a unit to smartfox and then store this information on a mySQL database. The plan is that i later can access this information during runtime and create a new unit based on that information. At the moment i am adding all the necessary information to a hashtable and then serializing it and sending it to smartfox as a byte array, but it doesn't work. Any ideas on how i can do this?

Code in Unity

Code: Select all

      MemoryStream memoryStream = new System.IO.MemoryStream();
      BinaryFormatter binaryFormatter = new BinaryFormatter();      
      SFSObject data = new SFSObject();      
      Hashtable info = new Hashtable();
      //Adds information about the unit.
      info.Add("unitSize", 12.52f);
      info.Add("skills", 1);
      info.Add("description", "This is a unit");
      Mesh objMesh = gameObject.GetComponent<MeshFilter>().mesh;
      //Adds the information necessary for recreating the mesh.
      info.Add("vertices", VectorToFloatArray(objMesh.vertices));
      info.Add("uv", VectorToFloatArray(objMesh.uv));
      info.Add("normals", VectorToFloatArray(objMesh.normals));
      info.Add("triangles", objMesh.triangles);
      info.Add("texture", unit.EncodeToPNG());      
      binaryFormatter.Serialize(memoryStream, info);
      Sfs2X.Util.ByteArray byteArray = new Sfs2X.Util.ByteArray(memoryStream.ToArray());
      data.PutByteArray("unit", byteArray);
      smartfox.Send(new ExtensionRequest("unitToSQL", data, meshLogin.smartfox.LastJoinedRoom, false));

Error in Smartfox Console

Code: Select all

12:37:31,547 INFO  [com.smartfoxserver.v2.controllers.SystemController-1] api.SFSApi     - Login in, { Zone: test }, ( User Name: Birch, Id: 2, Priv: 0, Sess: )
12:37:31,586 INFO  [com.smartfoxserver.v2.controllers.SystemController-1] api.SFSApi     - Room created: [ Room: A Room, Id: 4, Group: default, isGame: true ]
12:37:40,139 ERROR [1519652738@qtp-878483699-6] mortbay.log     - /BlueBox/
java.lang.IllegalStateException: Form too large304942>200000
   at org.mortbay.jetty.Request.extractParameters(
   at org.mortbay.jetty.Request.getParameter(
   at com.smartfoxserver.v2.bluebox.SessionFilter.doFilter(
   at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(
   at org.mortbay.jetty.servlet.ServletHandler.handle(
   at org.mortbay.jetty.servlet.SessionHandler.handle(
   at org.mortbay.jetty.handler.ContextHandler.handle(
   at org.mortbay.jetty.webapp.WebAppContext.handle(
   at org.mortbay.jetty.handler.ContextHandlerCollection.handle(
   at org.mortbay.jetty.handler.HandlerCollection.handle(
   at org.mortbay.jetty.handler.HandlerWrapper.handle(
   at org.mortbay.jetty.Server.handle(
   at org.mortbay.jetty.HttpConnection.handleRequest(
   at org.mortbay.jetty.HttpConnection$RequestHandler.content(
   at org.mortbay.jetty.HttpParser.parseNext(
   at org.mortbay.jetty.HttpParser.parseAvailable(
   at org.mortbay.jetty.HttpConnection.handle(
   at org.mortbay.thread.QueuedThreadPool$

Re: Can't send request.

Posted: 19 Jul 2012, 07:51
by ThomasLund
It seems that your client uses Bluebox? At least the server error comes from there. And doesnt seem client related (other than you might want to check why you are sending on bluebox and not regular socket - wrong port?

We send 2-3 MB of game state to our servers in the latest game with no issue - over sockets.

12:37:40,139 ERROR [1519652738@qtp-878483699-6] mortbay.log - /BlueBox/
java.lang.IllegalStateException: Form too large304942>200000

I dont know where the server has a setting for size of form submits. I would try to ask in the main forums here: viewforum.php?f=18