Sorry for all the questions and now it's not even on topic, but I really find it pointless to make a new topic. Anyways, I'm making something that I can announce stuff while on another server using TCPObjects, but they don't seem to be working.
new TCPobject(AServerTCP);
function AServerTCP::onConnectRequest(%this, %ip, %socket)
{
%this.connection[%ip] = new TCPobject("",%socket) {
class = AClientTCP;
parent = %this;
};
}
function AServerTCP::onLine(%this, %line)
{
announce(%line);
}
AServerTCP.listen(3000);
function AClientTCP::onLine(%this, %line)
{
echo(%line);
}
function AClientTCP::onConnected(%this)
{
$LRA::Connected = 1;
}
function AClientTCP::onDisconnect(%this)
{
%this.delete();
}
$LRA::Connected = 0;
function LongRangeAnnounce(%ip, %port, %msg) {
if(!$LRA::Connected) {
$LRA::TCP = new TCPobject(AClientTCP);
$LRA::TCP.connect(%ip @ ":" @ %port);
}
$LRA::TCP.send(%msg);
}
Obviously it's not secured yet, but I'm trying to get the basics working first. It connects successfully, but when I send stuff from the client, onLine is not receiving anything.