Game Development Community

T3D 1.1 Beta 2 - tcpObject does not appear to be implemented - RESOLVED

by David McDonald · in Torque 3D Professional · 08/06/2010 (2:15 am) · 11 replies

So our tcp object doesn�t send anything - and the reason why is because it�s not implemented!? (Excuse the poor formatting, my output from vis studio into a text file was quirky.)

DefineEngineMethod(TCPObject, send, void, (const char* paramList),, "Parameters are transmitted to the server as strings, one at a time.n"
                                                                                                                      "@param paramList List of parameters to send back to the server, separated by spaces.n"
"@tsexamplen"
"// Set the parameterListn"
"%paramList = ""GET " @ $RSSFeed::serverURL @ " HTTP/1.0nHost: " @ $RSSFeed::serverName @ "nUser-Agent: " @ $RSSFeed::userAgent @ "nrnrn""nn"
"// Send the parameter list back to the active server.n"
"%thisTCPObj.send(%paramList);n"
"@endtsexamplen"
"@ingroup Platformn"
{
/*
U32 unitCount = StringUnit::getUnitCount( paramList, " tn" );
const char* currStringElement;
for(U32 i = 2; i < unitCount; i++)
{
currStringElement = t2dSceneObject::getStringElement(paramList,i);
object->send((const U8 *) currStringElement, dStrlen(currStringElement));
}
*/
}
Tried implementing t2dSceneObject::getStringElement(paramList,i); as part of TcpObject as a temp soln � right/wrong or otherwise
Result was:
{

   U32 unitCount = StringUnit::getUnitCount( paramList, " tn" );
   const char* currStringElement;
   for(U32 i = 0; i <= unitCount; i++)
   {
     currStringElement = object->getStringElement(paramList,i);
     object->send((const U8 *) currStringElement, dStrlen(currStringElement));
   }
}
Stuck some console debug print statements in the above as well testing, and it looks like the right info is being processed/ sent to object->send�so I�m thinking maybe the online callback isn�t working?

The onConnect callback is firing � but either the send is failing/not sending � or the online callback isn�t working�

TorqueScript related:
package packageName {

   function TCPObject::onConnected(%this)
   {

     &Atilde;&cent;&iuml;&iquest;&frac12;&Acirc;&brvbar;with trace(1) on its getting here no problems

      %postdata = <omitted stuff>

      %this.send("POST /"@%path@" HTTP/1.1rnHost: "@$AuthServer@"rnContent-type: application/x-www-form-urlencodedrnConnection: closernContent-length: " @ strlen(%postdata) @ "rnrn" @ %postdata @ "rn");

   }

                function TCPObject::onLine( %this, %line ) 

                {

.. but never gets here

               }

#1
08/06/2010 (2:21 am)
I don't see where you called parent::onConnected(%this); in the package. Would that help
#2
08/06/2010 (3:28 am)
@Devon, thanks.
the parent::onConnected didn't help - but some more debugging and patience has found that...

It is getting to the onLine - eventually...its just taking more than the keepAlive value before it returns a bad request headers from the Auth Host
So the format of how it's being sent is still screwy...

changing the send to:
{
      object->send((const U8 *) paramList, dStrlen(paramList));
}
seems to do the trick, but would appreciate someone with more technical knoweldge in this area on how correct that is.

#3
08/11/2010 (5:13 pm)
Logged as TQA-784 for the QA team to verify.
#4
08/12/2010 (8:11 pm)
Bug confirmed.
#5
08/30/2010 (6:40 pm)
This has been fixed in 1.1 Beta 3.

Send has been reimplemented and now takes a single string command instead of a parameter list.
#6
09/06/2010 (9:33 pm)
After getting back from being away for holidays in the summer I am now getting around to migrating my project from 1.0.1 to 1.1 b2...

I spent the last 45mins or so pulling out my hair on what is seems is this bug I believe this same issue as listed above, is there any way to confirm what the source SHOULD be or what it will have in B3 and I can just make this change manually and recompile myself until b3 comes out?

Thanks in advance!

Let me know if you need any details from me.

#7
09/06/2010 (9:35 pm)
Also if there is a way to look up these bugs on my end and see what was changed that would be perfect. I am assuming though that "TQA-784" is internal...
#8
09/08/2010 (2:51 pm)
Bump - not a fan of bumping myself but after 2 days, bumps are good. Hopefully someone from GG can help me out here..

I am looking to confirm that they used the fix as above, if not what is the fix in the code for this. So that I can make the changes to what it Will be and recompile.

Thanks!
#9
09/08/2010 (4:57 pm)
Looks like the fix for Beta3 entailed changing the callback to accept a string command rather than a list of parameters.
#10
09/08/2010 (5:12 pm)
The fix was to remove the "feature" that send was multiple commands. Send now sends a single command... if you want to send multiple commands call send multiple times.

DefineEngineMethod(TCPObject, send, void, (const char *data),, "Transmits the data string to the server.\n"
													"@param data The data string to send back to the server.\n"
													"@tsexample\n"
														"// Set the command data\n"
														"%data = \"\"GET \" @ $RSSFeed::serverURL @ \" HTTP/1.0\nHost: \" @ $RSSFeed::serverName @ \"\nUser-Agent: \" @ $RSSFeed::userAgent @ \"\n\r\n\r\n\"\"\n\n"
														"// Send the command back to the active server.\n"
														"%thisTCPObj.send(%data);\n"
													"@endtsexample\n"
													"@ingroup Platform\n")
{
   object->send( (const U8*)data, dStrlen(data) );
}
#11
09/09/2010 (4:16 am)
Perfect Thanks Michael and Tom for the clarification.

Got everything up and running..