1
Modification Help / TCPObjects not correctly sending
« on: July 27, 2014, 01:38:05 AM »
I can't seem to properly get this TCPObject to work. I'm trying to make it so I can announce from another server to my server. Am I doing something wrong?
Code: [Select]
new TCPobject(AServerTCP);
function AServerTCP::onConnectRequest(%this, %ip, %socket)
{
echo("Connected"); //This does echo
%this.connection[%ip] = new TCPobject(AServerTCP_Inst, %socket)
{
parent = %this;
};
}
function AServerTCP_Inst::onLine(%this, %line)
{
echo("Server"); //This does not echo
announce(%line);
}
AServerTCP.listen(3000);
function AClientTCP::onLine(%this, %line)
{
echo(%line);
}
function AClientTCP::onConnected(%this)
{
$LRA::Connected = 1;
}
function AClientTCP::onDisconnect(%this)
{
$LRA::Connected = 0;
%this.delete();
}
$LRA::Connected = 0;
function LongRangeAnnounce(%msg) {
if($LRA::Connected)
$LRA::TCP.send(%msg);
echo("Client"); //This does echo
}
function StartClientTCP() {
$LRA::TCP = new TCPobject(AClientTCP);
$LRA::TCP.connect("127.0.0.1:3000"); //This port is forwarded and I'm on localhost anyways
echo("Create Client TCP"); //This does echo
}