private void ReceiveCallback(IAsyncResult ar) { Socket Socket = (Socket)ar.AsyncState; try { int received = Socket.EndReceive(ar); if (received <= 0) { CloseClient(Index); } else { byte[] databuffer = new byte[received]; Array.Copy(_buffer, databuffer, received); hostServer.HandleNetworkInformation(Index, databuffer); Socket.BeginReceive(_buffer, 0, _buffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), Socket); } } catch (Exception e) { Debug.LogError(e); CloseClient(Index); } }