Author Topic: Can't correctly manipulate quotation marks in a string  (Read 4310 times)

Did you do TCPObject.listen(portHere); ?
If you look over the code, yes. As I said before, it connects just fine but I can't get it to send any information.

Another question, is there something like onTextChanged or something that I can use for the TextEdit profile or do I need to make one?

I believe the command field will be called every time you edit the field. It's been a while since I've worked with GUIs, though.

I believe the command field will be called every time you edit the field. It's been a while since I've worked with GUIs, though.
Yes, yes it will.

It works perfectly, but I'm still having troubles with the TCPObjects

Someone wrote a small tutorial on it, I'll go find it. (iirc it was made by Trinick)

EDIT: Here.

Someone wrote a small tutorial on it, I'll go find it. (iirc it was made by Trinick)

EDIT: Here.
That's about downloading binary files from websites, but he wants to connect two blocklands together and send text.

The individual connection is handled by the no-name object you create in onConnectRequest, not the AServerTCP. Change it to something like this to receive the data:

function AServerTCP::onConnectRequest(%this, %ip, %socket)
{
   %this.connection[%ip] = new TCPobject(AServerTCP_Inst, %socket)
   {
      parent = %this;
   };
}


And then you can do this:

function AServerTCP_Inst::onLine(%this, %line)
{
   announce(%line);
}

So you're saying that

new TCPObject(AServerTCP);

function AServerTCP::onConnectRequest(%this, %ip, %socket)
{
   %this.connection[%ip] = new TCPObject(AServerTCP_Inst, %socket)
   {
      parent = %this;
   };
}

function AServerTCP_Inst::onLine(%this, %line)
{
   announce(%line);
}

AServerTCP.listen(3000);

function AClientTCP::onLine(%this, %line)
{
   warn(%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);
}

would work? And then what IP/port would you use - how would you get it to go through? longRangeAnnounce(YourIPAddress, "3000", "This is a line!");?
I can't test because I'm on my phone.

I tried it earlier and it didn't work for me.

And then what IP/port would you use
As you're listening on port 3000, I'd connect the client to 127.0.0.1:3000 for testing. If you want to do it on a different computer, you'll need to forward port 3000 and connect to the external IP of the server.

Still nothing. Is there anything specific I am supposed to do with the code because I just execute it all and just try it on my own server.

You'll have to wait with sending the line until you get the onConnected callback, just calling connect and then sending the request won't work.

Does it still not work if you call the function, wait 15 seconds, and call it again?