Blockland Forums > Modification Help
Server TCP Objects not functioning properly, client are fine - Solved
Port:
--- Quote from: Lugnut1206 on May 07, 2012, 03:57:23 PM ---i don't understand, I need to do
Client::onLine?
--- End quote ---
yes
you will never receive lines from yourself (the server)
you receive lines from clients
isn't this obvious
Lugnut:
no
i figured that lugsTCPServ::onLine was called when lugsTCPServ received a line
not like
where it came from or something
does the class = lugsTCPServ thing need to exist
can i remove it, if I'm understanding you right you're saying it has no functionality
Port:
--- Quote from: Lugnut1206 on May 07, 2012, 04:01:48 PM ---no
i figured that lugsTCPServ::onLine was called when lugsTCPServ received a line
not like
where it came from or something
--- End quote ---
well that's clearly not what you were thinking
you used these arguments: %this, %line
how were you planning to figure out who sent it
Lugnut:
--- Quote from: Port on May 07, 2012, 04:03:23 PM ---well that's clearly not what you were thinking
you used these arguments: %this, %line
how were you planning to figure out who sent it
--- End quote ---
i figured it was more straight forward
i have no idea
yeah, now it's working exactly as intended. thanks port!
Port:
and please do this
--- Quote from: Port on May 07, 2012, 03:55:54 PM ---also name the client type more privately
don't give it such an ambiguous name that other mods might use
--- End quote ---
if you're going to be sending a lot of stuff you should do this because of the TCPObject implementation's poor quality
--- Quote from: Port on May 07, 2012, 03:43:37 PM ---I recommend representing elements in packets using a single byte instead of a long string.
In a initialization function, you could define the protocol, i.e.:
%this.callback[ "\x01" ] = "kill_everyone";
%this.callback[ "\x02" ] = "delete";
Then, when receiving a packet, do a variable lookup on the first character.
--- End quote ---