Author Topic: TCPObjects not correctly sending  (Read 1776 times)

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
}

Make sure when you send a line, you end it with "\r\n".
I've had that problem a bunch of times before, I normally just end the send function with it.

Make sure when you send a line, you end it with "\r\n".
I've had that problem a bunch of times before, I normally just end the send function with it.
.......how did we all miss this in the last topic?

.......how did we all miss this in the last topic?
Wow lol all of us missed that. Overthinking it I guess. That's like the most basic tcp stuff. I feel dumb now.

Thank you all for the help.

In my defense I never actually read his code in the last topic because by the time I got there it looked like his problem had been resolved. :cookieMonster:

« Last Edit: July 28, 2014, 03:45:12 PM by Cruxeis »