public void Log(string condtion, string stack, LogType type)
        {
            LogData log = new LogData();

            log.condition  = condtion;
            log.stackTrace = stack;
            log.type       = type;
            var str = JsonUtility.ToJson(log);

            link.Send(Encoding.UTF8.GetBytes(str), EnvelopeType.String);
        }
 public void Redirect(string ip, int port)
 {
     if (kcp == null)
     {
         kcp = new KcpServer <KcpSocket>(0);
         kcp.Run(1);
     }
     if (link == null)
     {
         var address = IPAddress.Parse(ip);
         link = kcp.FindOrCreateLink(new IPEndPoint(address, port));
         link.Send(new byte[1], 0);
     }
     else
     {
         var add = IPAddress.Parse(ip);
         link.endpPoint.Address = add;
         link.endpPoint.Port    = port;
         var b = add.GetAddressBytes();
         unsafe
         {
             fixed(byte *bp = &b[0])
             link.ip = *(Int32 *)bp;
         }
         link.port = port;
         link.envelope.Clear();
         link.metaData.Clear();
     }
 }
        public void Connection(string ip, int port)
        {
            UniId = SystemInfo.deviceUniqueIdentifier;
            var address = IPAddress.Parse(ip);
            var kcp     = new KcpServer <KcpSocket>(0, 1);

            kcp.Run();
            link = kcp.FindOrCreateLink(new IPEndPoint(address, port));
            link.Send(new byte[1], 0);
        }
        public void Connection(string ip, int port)
        {
            if (kcp == null)
            {
                kcp = new KcpServer <KcpSocket>(0);
                kcp.Run(1);
            }
            var address = IPAddress.Parse(ip);

            link = kcp.FindOrCreateLink(new IPEndPoint(address, port));
            link.Send(new byte[1], 0);
        }
 void SendAesJson(byte[] dat)
 {
     link.Send(dat, EnvelopeType.AesJson);
 }