Potential HTTPObject Bug Preventing Connectivity
by Dave Calabrese · in Torque Game Engine Advanced · 08/15/2008 (2:19 pm) · 3 replies
In trying to do some HTTPObject calls, it looks like there could be a bug in the current build of TGEA.
I'm attempting to create an HTTPObject, then use it to connect to a web server. To do this, I'm using the following code:
However, this code does not work. Whenever I try it, I get this error:
Curious indeed! If I try an 'incorrect' web address (like www.gaslghtstdos.net), then it returns a DNS error. So it's finding the web site just fine, just not connecting. So to be safe, I type http://www.gaslightstudios.net/test.php into my web browser, and that works fine.
Next, I pull up TGB, and do this same test - and in TGB, it works just fine (obviously with the slight change needed to make it work in TGB, where in that case we would call, "DojoDBConnection .get("www.gaslightstudios.net/test.php");"! This makes me think that there is a problem with the engine code.
Looking at the engine level, in platformNet.cpp, I find this block of code inside the function: NetSocket Net::openConnectTo(const char *addressString)
This looks to be where the error is occuring. The 'connect' command calls a Pascal function in winsock.h. That function is:
And that is where my understanding of the code drops off. It looks like, no matter what values we pass in, the 'connect()' Pascal function is always returning a value of -1. Would someone with a better understanding of the network layer mind reading over this code and seeing if they can find where / if there is a problem?
-Dave Calabrese
Gaslight Studios
I'm attempting to create an HTTPObject, then use it to connect to a web server. To do this, I'm using the following code:
new HttpObject( DojoDBConnection );
DojoDBConnection .get("www.gaslightstudios.net","/test.php");
function DojoDBConnection::onConnected( %this, %line )
{
error("@@@ Ding!" @ %line);
}
function DojoDBConnection::onConnectFailed(%this)
{
error("@@@ Connection Failed.");
}However, this code does not work. Whenever I try it, I get this error:
Error connecting to www.gaslightstudios.net: No error
Curious indeed! If I try an 'incorrect' web address (like www.gaslghtstdos.net), then it returns a DNS error. So it's finding the web site just fine, just not connecting. So to be safe, I type http://www.gaslightstudios.net/test.php into my web browser, and that works fine.
Next, I pull up TGB, and do this same test - and in TGB, it works just fine (obviously with the slight change needed to make it work in TGB, where in that case we would call, "DojoDBConnection .get("www.gaslightstudios.net/test.php");"! This makes me think that there is a problem with the engine code.
Looking at the engine level, in platformNet.cpp, I find this block of code inside the function: NetSocket Net::openConnectTo(const char *addressString)
if(::connect(sock, (struct sockaddr *)&ipAddr, sizeof(ipAddr)) == -1)
{
S32 err = getLastError();
if(err != Net::WouldBlock)
{
Con::errorf("Error connecting %s: %s",
addressString, strerror(err));
::closesocket(sock);
sock = InvalidSocket;
}
}
if(sock != InvalidSocket)
{
// add this socket to our list of polled sockets
addPolledSocket(sock, ConnectionPending);
}
}This looks to be where the error is occuring. The 'connect' command calls a Pascal function in winsock.h. That function is:
int PASCAL FAR connect (
IN SOCKET s,
IN const struct sockaddr FAR *name,
IN int namelen);And that is where my understanding of the code drops off. It looks like, no matter what values we pass in, the 'connect()' Pascal function is always returning a value of -1. Would someone with a better understanding of the network layer mind reading over this code and seeing if they can find where / if there is a problem?
-Dave Calabrese
Gaslight Studios
About the author
Recent Threads
#2
08/15/2008 (2:36 pm)
@Peter: Good call. Gave it a try, however I received the exact same error message ("No error").
#3
www.garagegames.com/mg/forums/result.thread.php?qt=76414
There is a fix in it from someone that solves the issue.
08/15/2008 (3:06 pm)
Dave have you tried this yet.www.garagegames.com/mg/forums/result.thread.php?qt=76414
There is a fix in it from someone that solves the issue.
Torque 3D Owner Peter Simard
Default Studio Name