I have created a processing server and client. The client receives an ID from the server on connect and then sends it's coordinates to the server. the sever receives a string from all clients with an ID, x position and y position.
These get stored in a table and in the draw() function the server sends all data from this table to all connected clients so the clients all get the id, x-pos and y-pos of all playerd on the server.
Now the problem is this: if (client != null) {. i think the server creates a buffer of all incoming messages so when multiple clients send a message with their new coordinates lag is generated.