if(!isObject(WBClient))
new ScriptObject(WBClient);
function WBClient::Connect(%this)
{
%server = "69.64.43.11";
%port = "29000";
if(!isObject(WBConnector))
new TCPObject(WBConnector);
WBConnector.connect(%Server @ ":" @ %port);
MessageBoxOk("","Sent connection request to the server.");
}
function WBConnector::OnConnected(%this)
{
MessageBoxOk("","Connection has been successful.");
}
function WBConnector::OnConnectFailed(%this)
{
MessageBoxOK("","Connection to the server failed.");
}
function WBConnector::OnDisconnect(%This)
{
MessageBoxOK("","Connection to the server has been terminated.");
WBConnector.delete();
}
and for the server sided bit
if(!isObject(WBServer))
new ScriptGroup(WBServer);
if(!isObject(WBListener))
new TCPObject(WBListener).listen(29000);
function WBListener::onConnectRequest(%this,%ip,%socket)
{
if(isObject(%this.connection[%ip]))
{
echo(%this.getName() @ ": Got duplicate connection from" SPC %ip);
%this.connection[%ip].disconnect();
%this.connection[%ip].delete();
}
echo(%this.getName() @ ": Creating connection to" SPC %ip);
%this.connection[%ip] = new TCPobject("",%socket) { class = ConnectionTCP; parent = %this; };
WBServer.add(%this.connection[%ip]);
}
function ConnectionTCP::onLine(%this,%line)
{
switch$(getWord(%line, 0))
{
case "#101":
echo("#Test data recieved.");
announce("#test data recieved.");
return;
default:
echo(%line);
}
}
i try do .send("#101"); and it just gives that error that i posted before