UDP TGE vs TGEA
by Nathan Bowhay (ESAL) · in Torque Game Engine Advanced · 02/23/2009 (11:53 am) · 7 replies
In TGE inside NetInterface::processPacketReceiveEvent we put in our own check before the normal torque if(prEvent->data[0] & 0x01). We are porting all of our code over to TGEA and this code seemed very similar, but upon further investigation it seams that processPacketReceiveEvent never gets called at least not when we send our own udp packets in.
I put a breakpoint at the beginning of the function and then sent some udp packets to torque through the correct port (28000) and the breakpoint never gets hit.
I noticed that in TGEA the only call having to do with udp was in:
void StandardMainLoop::init()
and it is:
// Hook in for UDP notification
Net::smPacketReceive.notify(GNet, &NetInterface::processPacketReceiveEvent);
In TGE there was a direct call to processPacketReceiveEvent in:
void GameInterface::processEvent(Event *event)
Can anyone help me out with this, I am disparately trying to figure out what has changed and how to get the old code up and running.
Thanks in advance for any help anyone can give.
I put a breakpoint at the beginning of the function and then sent some udp packets to torque through the correct port (28000) and the breakpoint never gets hit.
I noticed that in TGEA the only call having to do with udp was in:
void StandardMainLoop::init()
and it is:
// Hook in for UDP notification
Net::smPacketReceive.notify(GNet, &NetInterface::processPacketReceiveEvent);
In TGE there was a direct call to processPacketReceiveEvent in:
void GameInterface::processEvent(Event *event)
Can anyone help me out with this, I am disparately trying to figure out what has changed and how to get the old code up and running.
Thanks in advance for any help anyone can give.
#2
Thanks for the help.
02/23/2009 (1:56 pm)
Yeah lol that is just what I tracked down and that must be it, cause I am sending it using localhost.Thanks for the help.
#3
02/23/2009 (2:00 pm)
I think this should be reported as a bug.
#4
The first for loop always breaks. I am going to go look at the code after the first loop and see if I can end up finding where it goes.
02/23/2009 (3:19 pm)
hmm I noticed that it actually stops at if(bytesRead == -1) it does this many times even when not sending a thing and when sending something I can't ever end up finding my packet cause it seems to just continuously stop at this point.The first for loop always breaks. I am going to go look at the code after the first loop and see if I can end up finding where it goes.
#5
if (gPolledSockets.size() == 0)
and returns both when I send something and when a mission is just running.
02/23/2009 (3:23 pm)
It then hits:if (gPolledSockets.size() == 0)
and returns both when I send something and when a mission is just running.
#6
I think I have it from here.
Thanks for the help Tony!
02/23/2009 (3:43 pm)
I think it has something to do with the pack we started with. Cause I don't get this behavior with stronghold. I have to start a stronghold multilayer (checkbox) game and it works.I think I have it from here.
Thanks for the help Tony!
#7
02/23/2009 (5:14 pm)
I got it fully working, just needed it to be a multilayer game when the server is created (createServer( "MultiPlayer"...) and then the localhost check.
Torque 3D Owner Tony Richards
and make sure that's being hit and then trace through the code to see what's going on.
My first guess is that you're sending UDP data from localhost and this code:
if(srcAddress.type == NetAddress::IPAddress && srcAddress.netNum[0] == 127 && srcAddress.netNum[1] == 0 && srcAddress.netNum[2] == 0 && srcAddress.netNum[3] == 1 && srcAddress.port == netPort) continue;is preventing the data from getting through.