Esempio n. 1
0
        public void Connection(string ip, int port)
        {
            var address = IPAddress.Parse(ip);

            server = new KcpServer <KcpSocket>(0);
            server.Run(1);
            server.OpenHeart();
            var remote = new IPEndPoint(address, port);

            link = server.FindOrCreateLink(remote);
            server.soc.SendTo(KcpListener.Heart, remote);
            server.RejectAutoConnections = true;
        }
Esempio n. 2
0
 public void CloseLog()
 {
     if (KcpListener.Instance != null)
     {
         KcpListener.Instance.Dispose();
     }
     Application.logMessageReceived -= Log;
     if (link != null)
     {
         link.Dispose();
     }
     link = null;
     if (logs != null)
     {
         logs.Clear();
     }
 }
Esempio n. 3
0
 public void OpenLog(string ip = null, int port = 0)
 {
     Application.logMessageReceived += Log;
     if (ip == null | ip == "")
     {
         logLink = link;
     }
     else
     {
         var address = IPAddress.Parse(ip);
         logLink = server.FindOrCreateLink(new IPEndPoint(address, port));
     }
     if (logs == null)
     {
         logs = new List <LogData>();
     }
 }