Exemple #1
0
            public void Connect(TcpClient _socket)
            {
                socket = _socket; //assign the tcpclient thats passed in, to the socket field
                socket.ReceiveBufferSize = dataBufferSize;
                socket.SendBufferSize    = dataBufferSize;

                stream = socket.GetStream();

                receivedData = new Packet();

                receiveBuffer = new byte[dataBufferSize];

                //byte array that is the location in memeory to store data, read from the stream
                //the location in buffer to begin storing data --> 0
                // the number of bytes to read from the stream
                //async callback that gets executed when beginstream completes
                stream.BeginRead(receiveBuffer, 0, dataBufferSize, ReceiveCallback, null);

                ServerSend.Welcome(id, "Welcome to the server!");
            }
Exemple #2
0
 public void Update()
 {
     ServerSend.PlayerPosition(this);
     ServerSend.PlayerRotation(this);
 }