Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("WunderNet Test Server");
            string xmlPathDefault = @"D:\Documents\CodeProjects\WunderNet2\WunderServer\ExampleNet.xml";

            if (!System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
            {
                xmlPathDefault = @"/home/corey/Code/WunderNet2/WunderServer/ExampleNet.xml";
            }
            ws = new WunderTCPServer(xmlPathDefault, IPAddress.Any, 1234);
            ws.NewConnection += NewConnection;
            ws.AddDataCallback("Message", ServerMessage);
            ws.AddDataCallback("VariableLengthPacket", ServerMessage);
            Console.WriteLine(ws.GetNewPacket("VariableLengthPacket").ToString());
            ws.AcceptConnections();

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            string xmlPathDefault = @"D:\Documents\CodeProjects\WunderNet2\WunderServer\ExampleNet.xml";

            if (!System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
            {
                xmlPathDefault = @"/home/corey/Code/WunderNet2/WunderServer/ExampleNet.xml";
            }
            ws = new WunderTCPServer(xmlPathDefault, IPAddress.Any, 1234);
            wc = new WunderTCPClient(xmlPathDefault, "localhost", 1234);

            ws.NewConnection += NewConnection;
            ws.AddDataCallback("Message", ServerMessage);
            ws.AddDataCallback("WorldInfo", ServerWorldInfo);
            ws.AcceptConnections();


            wc.AddDataCallback("Message", ClientMessage);
            wc.Connect();

            Console.ReadKey();
        }