// Update is called once per frame
 void Update()
 {
     if (null != client && client.IsRunning() && Connected)
     {
         Delta += Time.unscaledDeltaTime;
         if (Delta > Heartbeat)
         {
             client.Send(PacketWraper.NewPacket(pb.ID.MSG_Heartbeat));
             Delta = 0;
         }
     }
 }
Exemple #2
0
    IEnumerator Co()
    {
        var i = 0;

        while (true)
        {
            yield return(new WaitForSeconds(1));

            String s = i + " hi,heoll world! 你好啊!!";
            //for (int i = 0; i < 2; i++)
            //{
            //    s = s + s;
            //}
            ByteBuf bb = new ByteBuf(System.Text.Encoding.UTF8.GetBytes(s));
            Console.WriteLine(bb.ReadableBytes());
            client.Send(bb);
            //Console.Read();

            i++;
        }
    }