Exemple #1
0
    // to send msg to server, use ConnectionManager.buffer_send.pushMsg(string);
    // the function down there will send at the appropriated moment.
    private void SendMsg()
    {
        int sizeToSend;

        byte[] bytesToSend;

        if ((sizeToSend = buffer_send.getLen()) > 0)
        {
            bytesToSend = buffer_send.ExtractBufferBytes();
            ClientSocket.Send(bytesToSend, 0, sizeToSend, SocketFlags.None);
            if (GameManager.instance.DebugPrintMode)
            {
                Debug.Log("Sending: [" + System.Text.Encoding.UTF8.GetString(bytesToSend) + "]");
            }
        }
    }