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
        static void Main(string[] args)
        {
            LocalFile.loadConfig();
            SqlControll.Initial();
            var kcp = new KcpServer <KcpUser>(8899);

            kcp.OpenHeart();
            kcp.Run();
            while (true)
            {
                var cmd = Console.ReadLine();
                if (cmd == "Close" | cmd == "close")
                {
                    break;
                }
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            KcpServer.CreateLink = (o) => { return(new KcpUser(o)); };
            var kcp = new KcpServer(8888);

            kcp.OpenHeart();
            RServer rs = new RServer();

            rs.name = "斗地主";
            rs.key  = "ert125dsaqwqf43bvrwurx24354tq245sd32dfkh348shdjfhs234sf5345";
            IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("193.112.70.170"), 6666);

            kcp.Send(KcpPack.PackObject <RServer>(ProCmd.Server, MessageType.Pro, rs), EnvelopeType.AesDataBuffer, endPoint);
            while (true)
            {
                var cmd = Console.ReadLine();
                if (cmd == "close" | cmd == "Close")
                {
                    break;
                }
            }
        }