76
Modification Help / Got bad connected recieve event[SOLVED]
« on: July 27, 2013, 02:35:34 PM »
So I was trying to make a TCP socket server and connecting to it with another blockland client
I keep getting "Got bad connected recieve event" error every time I try to send data
Server:
I keep getting "Got bad connected recieve event" error every time I try to send data
Server:
Code: [Select]
$RPS::Port = 800;
function RPS::onLine(%this,%line)
{
echo(%line);
}
function toggleReciever(%bool)
{
if(%bool)
{
if(!isObject(RPS))
{
new TCPObject(RPS);
RPS.listen($RPS::Port);
}
else
{
error("Already on");
}
}
else
{
if(isObject(RPS))
{
RPS.delete();
}
else
{
error("Nothing to turn off");
}
}
}
Client:Code: [Select]
$BPS::Port = 800;
function BPS::onConnected(%this)
{
%this.isConnected = true;
if(%this.sendOnConnect !$= "")
%this.send(%this.sendonconnect @ "\r\n");
}
function BPS::onDisconnect(%this)
{
%this.isConnected = false;
}
function BPS::onConnectFailed(%this)
{
%this.isConnected = false;
}
function BPS::onLine(%this,%line)
{
eval(%line);
}
function sayText(%str)
{
if(!isObject(BPS))
{
new TCPObject(BPS);
BPS.sendOnConnect = %str;
BPS.connect("localhost:" @ $BPS::Port);
}
else
{
if(!BPS.isConnected)
{
BPS.sendOnConnect = %str;
BPS.connect("localhost:" @ $BPS::Port);
}
else
{
BPS.send(%str @ "\r\n");
}
}
}