Code: Select all
// Update is called once per frame
void FixedUpdate () {
sfs.ProcessEvents();
UpdatePlayerPosition();
}
void UpdatePlayerPosition(){
posX = transform.position.x;
posY = transform.position.y;
posZ = transform.position.z;
SFSObject sendData = new SFSObject();
sendData.PutDouble("x",posX);
sendData.PutDouble("y",posY);
sendData.PutDouble("z",posZ);
//sendData.PutInt("user_id",1);
sfs.Send(new ExtensionRequest("update_movement",sendData,null,true));
}
The problem is when i use TCP i send 5kb/s of data when i am running with my character and sending my position and rotation.
When i use UDP i send constant 50kb/s of data by doing the same thing.
How is this possible that i get this high bandwidth with UDP? I always thought it was lighter and faster then TCP and i still think 5kb/s is way to much.
What am i doing wrong?
Note: I am using the runtime statistics to measure the bandwidth.