Here are some more Infos.
I decided to test only to send position Data each second or 2 seconds. the other player receives the data, but the position update only happens each 500 pixels that means the player jumps instead of a continouse movement.
The server is a normal server with the connection type Telnet instead of SSH or ...
With data overload i mean that the position data is sent a way to much so that the "endsystem" can´t work with it in an acceptable time.
In the following you can the the Method how to connect to the Server, how to send position data and how to receive positiondata
void ConnectToServer(TcpClient client, IPEndPoint serverEndPoint)
{
client.Connect(serverEndPoint);
clientStream = client.GetStream();
encoder = new ASCIIEncoding();
buffer = encoder.GetBytes("Hello Server!");
clientStream.Write(buffer, 0 , buffer.Length);
clientStream.Flush();
}
und hier für das Senden und Empfangen der Position:
public void SendPositionsdaten(float x, float y)
{
//{"from":1000,"to":[123,234,345],"message":{"cmd":"posupdate","x":1,"y":2}}
string jsonString = "";
if(username == "usera")
jsonString = "{\"to\":2,\"msg\":{\"x\":" + x + "}}";
if(client != null && client.Connected)
{
//clientStream = client.GetStream();
//encoder = new ASCIIEncoding();
buffer = encoder.GetBytes(jsonString);
clientStream.Write(buffer, 0 , buffer.Length);
clientStream.Flush();
}
}
if we receive position data we will only use its x value only for testing
public float receivePosition(string jsonBefehl)
{
var N = JSON.Parse(jsonBefehl);
//string fromVal = N["from"].ToString();
string toVal = N["to"].ToString();
string x = N["msg"]["x"];
string y = N["msg"]["y"];
float r = 0;
float.TryParse(x, out r);
return r;
}
hope you can understand my bad english and my problem better now ;)