Is there a more effective way to send coordinates than through split() or splittokens()?

edited February 2017 in Library Questions

So I'm trying to send coordinates between four players through a server using the networking library, and currently it seems like the easiest way to do that is to send a string such as:

positions= 0 + "," + ballX + "," + ballY + "," + p1 + "," + p2 + "\n";
myserver.write(positions);

And then receive it through:

void clientEvent(Client client) {
receivemessage=client.readUntil("\n");
datain = splittokens(receivemessage,",\n");
}

However, this seems to lag behind a bit as the buffer fills up and it slowly drifts further and further from real time. Should I stop sending strings and parsing them with splittokens() in favour of some other method, or should I just make sure that the client clears the buffer every once in a while?

Answers

Sign In or Register to comment.