Ejemplo 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;
        }
Ejemplo 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();
     }
 }
Ejemplo 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>();
     }
 }