I made the following test code to try setting up a simple TCP server.
new TCPObject(TCPListener);
$ListenOn = 31337;
function TCPListener::onConnectionRequest(%this, %addr, %id)
{ echo("Got a connection from {"@%addr@"}: "@%id); }
function TCPListener::onLine(%this, %line)
{ echo("Got line \""@%line@"\"."); }
TCPListener.listen($ListenOn);
new TCPObject(TCPTalker);
function TCPTalker::onConnected(%this)
{
echo("Successfully connected.");
%this.send("Test\r\n");
}
function TCPTalker::onDisconnect(%this)
{ echo("Got disconnected."); }
However, when I try to connect to the listener, I get this:
==>TCPTalker.connect("10.1.1.44:31337");
Successfully connected.
Got bad connected receive event.
Does anyone know what the problem is?