BobAndRob posted something about all this, just ran through it all in console for a quick test.
For connecting to a Torque TCPobject, the 'server' tcpobject needs an onConnectRequest function, which should look roughly like this:
function ServerTCP::onConnectRequest(%this,%ip,%socket)
{
if(isObject(%this.connection[%ip]))
{
echo(%this.getName() @ ": Got duplicate connection from" SPC %ip);
%this.connection[%ip].disconnect();
%this.connection[%ip].delete();
}
echo(%this.getName() @ ": Creating connection to" SPC %ip);
%this.connection[%ip] = new TCPobject("",%socket) { class = ConnectionTCP; parent = %this; };
}
function ConnectionTCP::onLine(%this,%line)
{
// do stuff here
}
Obviously this is just an example but you should be able to figure out what to do with it from there.
I would try and find BobAndRob's post about this though, I have no idea where it was and I'm too lazy to look but I'm sure he probably explained it properly.