Game Development Community

TCPObject bug

by Ian Omroth Hardingham · in Torque Game Engine · 05/11/2008 (7:37 am) · 2 replies

Hey guys.

It would appear that if you have a TCPObject whateverCon:

new TCPObject(WhateverCon);

And you set it to listen on one port

WhateverCon.listen(28001);

and then later on you set it to listen on another port

WhateverCon.listen(28002);

That some of the, er, magic TCP code doesn't clear port1 totally. To be honest this came up slightly bizarrely - with two instances of Torque running on one machine and trying to have a connection each way. But I think the bug is there.

Ian

#1
05/11/2008 (12:43 pm)
I haven't touched Torque in a while, matter of fact I got a new system this past Christmas and have yet to install TGE on it. Anyway, I would think there was a close() or maybe disconnect() functions you could use to unbind a port. I believe that the TCPObject was written to listen on multiple ports on purpose, but maybe the original programmer didn't think that somebody would want to stop listening on a previous port instead of just simply deleting/killing the entire TCPObject instance once done with it.

So, the easiest way to go around it is to delete and recreate the TCPObject and then listen on the next port. I do not recall how to delete or kill an instance of an object, again it has been a while. :)
#2
05/11/2008 (12:44 pm)
That sounds plausible, thanks Nathan - I guess you could well want to listen on two ports. Disaster averted!