示例#1
0
    static void Main(string[] args)
    {
        System.Console.WriteLine("Start Udp Client ...");

        PGN.Udp    pNet = new PGN.Udp(PGN.NTC.DNF_CLIENT);
        PGN.Packet pPck = new PGN.Packet();

        pNet.Create("127.0.0.1", 20000);

        int c = 0;

        int op = PGN.NTC.OP_CHAT;

        //string str = "ABCDEF HIJK: " + c;


        while (true)
        {
            ++c;
            Thread.Sleep(1000);

            string str = "Send Mesage: Hello world: " + c;
            pNet.SendTo(str, op);
        }

        pNet.Destroy();
    }
示例#2
0
    static void Main(string[] args)
    {
        System.Console.WriteLine("Start TCP Client ...");

        PGN.TcpCln pNet = new PGN.TcpCln();
        PGN.Packet pPck = new PGN.Packet();

        //pNet.Create(null, "192.168.0.20", 20000);
        pNet.Create(null, "127.0.0.1", 20000);
        pNet.Connect();

        int c = 0;

        while (true)
        {
            ++c;
            Thread.Sleep(1000);

            //float x = 100;
            //float y = 200;
            //float z = 300;

            int op = PGN.NTC.OP_CHAT;


            //string str = "ABCDEF HIJK: " + c;
            string str = "Send Mesage: Hello world: " + c;
            pNet.Send(str, op);


            //pPck.Reset();
            //pPck.PacketAdd(x);
            //pPck.PacketAdd(y);
            //pPck.PacketAdd(z);
            //pPck.PacketAdd(str);
            //pPck.EnCode(0, op);

            //PGN_TcpCln.PGN_Packet pck = new PGN_TcpCln.PGN_Packet();
            //pck.PacketAdd(c);
            //pck.PacketAdd(str);

            //pNet.Send(pck);
            //pNet.Send();
        }

        pNet.Destroy();
    }
示例#3
0
    static void Main(string[] args)
    {
        System.Console.WriteLine("Start TCP Server ...");

        PGN.TcpSvr pNet = new PGN.TcpSvr();
        PGN.Packet pPck = new PGN.Packet();

        pNet.Create("127.0.0.1", 20000);


        int c = 0;

        while (true)
        {
            ++c;
            Thread.Sleep(1000);

            //float x = 100;
            //float y = 200;
            //float z = 300;

            //int op = 0x12345678;


            ////string str = "ABCDEF HIJK: " + c;
            //string str = "Send Mesage: Hello world: " + c;


            //pPck.Reset();
            //pPck.PacketAdd(x);
            //pPck.PacketAdd(y);
            //pPck.PacketAdd(z);
            //pPck.PacketAdd(str);
            //pPck.EnPack(op, 0xAB, c);

            //pNet.Send(pPck);


            //PGN_TcpSvr.PGN_Packet pck = new PGN_TcpSvr.PGN_Packet();
            //pck.PacketAdd(c);
            //pck.PacketAdd(str);

            //pNet.Send(pck);
            //pNet.Send();
        }
    }