Compiled libs and tutorial code problems/solutions
by Zechner Mario · in Torque Game Engine · 09/12/2004 (2:27 am) · 9 replies
Greetings,
after 5 days of trying to compile tnl with codewarrior and devcpp i have to give up due to some compiler issues i just can't solve myself, i have no vc installed here, so i would really like somebody to give me the compiled libs. in exchange i could offer some virtual beer or whatever the person likes hehe...
yeah me sucks
thx anyway
mario
uh btw, would need them for win32
after 5 days of trying to compile tnl with codewarrior and devcpp i have to give up due to some compiler issues i just can't solve myself, i have no vc installed here, so i would really like somebody to give me the compiled libs. in exchange i could offer some virtual beer or whatever the person likes hehe...
yeah me sucks
thx anyway
mario
uh btw, would need them for win32
About the author
#2
but when i run the server and the client nothing happens, i'm used to programm with berkley sockets and stuff, so i know many of the possible errors, but it seems that devc++ is just completely messed up.
well i gave up on devc++ and tried vc6, but it seems like my vc6 version is kind of messed up, i did 2 reinstalls, installed the latest service pack and everything but it still gives me this exception(.h) not found, so seems like the stl part sucks.
i also tried it in codewarrior, but the ported version i got for it has that bug that kept the tutorial implementation from sending a message from the server to the client, funny thing is that tnltest runs nicely, how can that be? does it have to do with that lan broadcast thing?
well i'm getting pissed more and more, not because of tnl but of my own stupidity not being able to compile this. i never had that much problems with a library and it's not as if i never used libs that have to be compiled first before. i may laydown work for a few days and start all over again, though i don't think i forgot something
anyhow
thx
mario
(still a compiled version for win32 would be neat...)
09/12/2004 (1:23 pm)
Well i "ported" the crypt lib to dev by including some files directly instead of including them via #include (as it's done in the cvs version) it compiled nicely so did the tnl lib itself, and the simple tutorial code.but when i run the server and the client nothing happens, i'm used to programm with berkley sockets and stuff, so i know many of the possible errors, but it seems that devc++ is just completely messed up.
well i gave up on devc++ and tried vc6, but it seems like my vc6 version is kind of messed up, i did 2 reinstalls, installed the latest service pack and everything but it still gives me this exception(.h) not found, so seems like the stl part sucks.
i also tried it in codewarrior, but the ported version i got for it has that bug that kept the tutorial implementation from sending a message from the server to the client, funny thing is that tnltest runs nicely, how can that be? does it have to do with that lan broadcast thing?
well i'm getting pissed more and more, not because of tnl but of my own stupidity not being able to compile this. i never had that much problems with a library and it's not as if i never used libs that have to be compiled first before. i may laydown work for a few days and start all over again, though i don't think i forgot something
anyhow
thx
mario
(still a compiled version for win32 would be neat...)
#3
Might be best to take a break. :) Maybe Mark will post some libs - but if you can't get the lib compiled, it's unlikely you'll be able to compile anything that uses it... :-/
09/12/2004 (2:33 pm)
That's sort of odd, I didn't know TNL used STL...Might be best to take a break. :) Maybe Mark will post some libs - but if you can't get the lib compiled, it's unlikely you'll be able to compile anything that uses it... :-/
#4
ok i compiled tnltest, runs fine, i compiled zap runs fine...
i tried to compile the tutorial code and it does nothing, i'll start debugging it and hopefully find some solution to this
i have no firewall installed, and this are the arguments
simpletnl -server 127.0.0.1:5001
simpletnl -client 127.0.0.1:5001
maybe somebody can give me a hint (rtti is enabled)
thank you for your patience
mario
09/13/2004 (3:52 am)
Well i now was able to compile tnl, as i said it was a vc installation related problem, and yeah something uses the exception baseclass, but i can't remember exactly what it was, had to do with new, excuse me for not giving any futher hint on that, i may try to reproduce it in the next few couple of days (though it has definetly to do with vc not your source...)ok i compiled tnltest, runs fine, i compiled zap runs fine...
i tried to compile the tutorial code and it does nothing, i'll start debugging it and hopefully find some solution to this
i have no firewall installed, and this are the arguments
simpletnl -server 127.0.0.1:5001
simpletnl -client 127.0.0.1:5001
maybe somebody can give me a hint (rtti is enabled)
thank you for your patience
mario
#5
#include "tnl.h"
#include "tnlEventConnection.h"
#include "tnlNetInterface.h"
#include "tnlRPC.h"
#include
using namespace TNL;
class myConnection: public EventConnection
{
public:
TNL_DECLARE_NETCONNECTION(myConnection);
myConnection() { printf("constructing myConnection instance\n"); };
~myConnection() { printf("destructing myConnection instance\n"); };
void onConnectionEstablished(bool isInitiator)
{
printf("connection established");
}
};
TNL_IMPLEMENT_NETCONNECTION(myConnection, NetClassGroupGame, true);
// remote connection on localhost
int main(int argc, char* argv[])
{
bool isServer=false;
if(!strcmp(argv[0], "-server"))
isServer=true;
else
isServer=false;
NetInterface *theNetInterface;
Address remoteAddress("127.0.0.1:5002");
if(!isServer)
{
Address bindAddress(IPProtocol, Address::Any, 5001);
// create a new NetInterface bound to any interface, any port (0)
theNetInterface = new NetInterface(bindAddress);
// create a new SimpleEventConnection and tell it to connect to the
// server at cmdAddress.
myConnection *newConnection = new myConnection;
newConnection->connect(theNetInterface, remoteAddress);
}
else
{
// create a server net interface, bound to the cmdAddress
theNetInterface = new NetInterface(remoteAddress);
// notify the NetInterface that it can allow connections
theNetInterface->setAllowsConnections(true);
}
// now just loop, processing incoming packets and sending outgoing packets
// until the global quit flag is set.
while(1)
{
theNetInterface->checkIncomingPackets();
theNetInterface->processConnections();
//Platform::sleep(1);
}
return 0;
}
hm, i didn't know that before, but for some reason the myConnection instances destruct themselves after a period of time, what makes debugging somewhat impossible. still onConnectionEstablished is not called and i have no clue why, i hardcoded ip:port for client and server but again nothing happens, except for constructing and destructing. so seems like you inserted some kind of garbage collector or something similar...
i linked tnld.lib libtomcrypt.lib and wsock32.lib as they are needed. again, all other examples work (tnltest, zap) but the simple try to establish a connection from one process to another on the same machine (that would be needed to debug any more complex progs using tnl) does not work...
i'm really stuck. am i pissing you off already? ;)
greetings
09/13/2004 (6:54 am)
Here's some source i was trying to debug#include "tnl.h"
#include "tnlEventConnection.h"
#include "tnlNetInterface.h"
#include "tnlRPC.h"
#include
using namespace TNL;
class myConnection: public EventConnection
{
public:
TNL_DECLARE_NETCONNECTION(myConnection);
myConnection() { printf("constructing myConnection instance\n"); };
~myConnection() { printf("destructing myConnection instance\n"); };
void onConnectionEstablished(bool isInitiator)
{
printf("connection established");
}
};
TNL_IMPLEMENT_NETCONNECTION(myConnection, NetClassGroupGame, true);
// remote connection on localhost
int main(int argc, char* argv[])
{
bool isServer=false;
if(!strcmp(argv[0], "-server"))
isServer=true;
else
isServer=false;
NetInterface *theNetInterface;
Address remoteAddress("127.0.0.1:5002");
if(!isServer)
{
Address bindAddress(IPProtocol, Address::Any, 5001);
// create a new NetInterface bound to any interface, any port (0)
theNetInterface = new NetInterface(bindAddress);
// create a new SimpleEventConnection and tell it to connect to the
// server at cmdAddress.
myConnection *newConnection = new myConnection;
newConnection->connect(theNetInterface, remoteAddress);
}
else
{
// create a server net interface, bound to the cmdAddress
theNetInterface = new NetInterface(remoteAddress);
// notify the NetInterface that it can allow connections
theNetInterface->setAllowsConnections(true);
}
// now just loop, processing incoming packets and sending outgoing packets
// until the global quit flag is set.
while(1)
{
theNetInterface->checkIncomingPackets();
theNetInterface->processConnections();
//Platform::sleep(1);
}
return 0;
}
hm, i didn't know that before, but for some reason the myConnection instances destruct themselves after a period of time, what makes debugging somewhat impossible. still onConnectionEstablished is not called and i have no clue why, i hardcoded ip:port for client and server but again nothing happens, except for constructing and destructing. so seems like you inserted some kind of garbage collector or something similar...
i linked tnld.lib libtomcrypt.lib and wsock32.lib as they are needed. again, all other examples work (tnltest, zap) but the simple try to establish a connection from one process to another on the same machine (that would be needed to debug any more complex progs using tnl) does not work...
i'm really stuck. am i pissing you off already? ;)
greetings
#6
09/13/2004 (8:16 am)
Make sure the IPs and ports are different. Right now you're trying to make them both talk over the same place! Make one 5001 and the other 5002, for instance.
#7
the clients interface is bound to any:5001 (where any should be 127.0.0.1 or my external visible ip)
the servers interface is bound to 127.0.0.1:5002
so this seems to me to be a perfect inbound connection setup, and it just worked fine with berkley.
but maybe i'm just a dumbass not capable of working with tnl hihi, in that case i'll turn to berkley again, altough your lib is really cool from my point of few.
thx
EDIT:
as pointed out by Tsuyoshi Abe here
http://www.garagegames.com/mg/forums/result.thread.php?qt=21029
one has to include a loop to force sending the connection packages out to the server
** in main() **
newConnection->connect(theNetInterface, cmdAddress);
+ while(1) {
+ theNetInterface->checkIncomingPackets();
+ theNetInterface->processConnections();
+ if(newConnection->isEstablished())
+ break;
+ }
newConnection->rpcMessageClientToServer("Hello??");
*****************
that solved my problem, but still i don't get it, because as far as i know packages are stored (also rpc packages) until the interface is able to send them, so since the mainloop does the same as the included loop above this should work without that loop too. cause even if the connection is not ready the rpc packages should be stored.
thx to Tsuyoshi Abe
09/13/2004 (8:43 am)
Well i did so (if you have a look at the code), i'm used to programm berkley sockets, i know how to do windowed udp stuff etc. so i can say i know fairly enough about networking, that's not the problem, as it is not a problem to have to programms using the same ip, if i use different ports (what i do in the small application above) but still it won't work strange. if you can point at the line of code above that has the error contained i would be gracefull, cause in my eyes this should workthe clients interface is bound to any:5001 (where any should be 127.0.0.1 or my external visible ip)
the servers interface is bound to 127.0.0.1:5002
so this seems to me to be a perfect inbound connection setup, and it just worked fine with berkley.
but maybe i'm just a dumbass not capable of working with tnl hihi, in that case i'll turn to berkley again, altough your lib is really cool from my point of few.
thx
EDIT:
as pointed out by Tsuyoshi Abe here
http://www.garagegames.com/mg/forums/result.thread.php?qt=21029
one has to include a loop to force sending the connection packages out to the server
** in main() **
newConnection->connect(theNetInterface, cmdAddress);
+ while(1) {
+ theNetInterface->checkIncomingPackets();
+ theNetInterface->processConnections();
+ if(newConnection->isEstablished())
+ break;
+ }
newConnection->rpcMessageClientToServer("Hello??");
*****************
that solved my problem, but still i don't get it, because as far as i know packages are stored (also rpc packages) until the interface is able to send them, so since the mainloop does the same as the included loop above this should work without that loop too. cause even if the connection is not ready the rpc packages should be stored.
thx to Tsuyoshi Abe
#8
09/14/2004 (2:46 am)
Anybody having an explanation why i can only connect two time to the server of the tutorial code? the third time it simply doesn't responde, i'm using the original source plus the loop included above
#9
insert this into main.cpp, where the true isClient branch is executed (client setup)
#################################################
// create a new SimpleEventConnection and tell it to connect to the
// server at cmdAddress.
newConnection->connect(theNetInterface, cmdAddress);
U32 start_time = Platform::getRealMilliseconds();
while(1) {
if(newConnection==0)
{
newConnection = new SimpleEventConnection;
newConnection->connect(theNetInterface, cmdAddress);
}
if(newConnection->isEstablished())
break;
theNetInterface->checkIncomingPackets();
theNetInterface->processConnections();
printf("Trying to connect\n");
}
// post an RPC, to be executed when the connection is established
newConnection->rpcMessageClientToServer("Hello??");
#################################################
plus newConnection has to be a SafePtr so it get's null when it is destructed.
it can happen that the connection instance is destructed after sometime (e.g. the server doesn't respond), that's when the newConnection is set to null and we have to reconnect. one may count reconnection attempts/time used for connection and do a timeout after some number of attempts/time.
09/14/2004 (3:34 am)
Ok one solution to this problem mentioned aboveinsert this into main.cpp, where the true isClient branch is executed (client setup)
#################################################
// create a new SimpleEventConnection and tell it to connect to the
// server at cmdAddress.
newConnection->connect(theNetInterface, cmdAddress);
U32 start_time = Platform::getRealMilliseconds();
while(1) {
if(newConnection==0)
{
newConnection = new SimpleEventConnection;
newConnection->connect(theNetInterface, cmdAddress);
}
if(newConnection->isEstablished())
break;
theNetInterface->checkIncomingPackets();
theNetInterface->processConnections();
printf("Trying to connect\n");
}
// post an RPC, to be executed when the connection is established
newConnection->rpcMessageClientToServer("Hello??");
#################################################
plus newConnection has to be a SafePtr so it get's null when it is destructed.
it can happen that the connection instance is destructed after sometime (e.g. the server doesn't respond), that's when the newConnection is set to null and we have to reconnect. one may count reconnection attempts/time used for connection and do a timeout after some number of attempts/time.
Associate Kyle Carter