Beispiel #1
0
        static void Main(string[] args)
        {
            SharedXmlConfigReader cr = new SharedXmlConfigReader();
            var cfg = cr.Load( File.OpenText("../../../../data/SharedConfig.xml") );

            var cl = new Client("cl1", "localhost", 12345);
            cl.Connect();

            LaunchPlan plan1 = new LaunchPlan(
                "plan1",
                new List<AppDef>()
                {
                    new AppDef() { AppIdTuple = new AppIdTuple("m1", "a"), StartupOrder = -1, Dependencies=new List<string>() {"b"} },
                    new AppDef() { AppIdTuple = new AppIdTuple("m1", "b"), StartupOrder = -1, },
                    new AppDef() { AppIdTuple = new AppIdTuple("m1", "c"), StartupOrder = -1, Dependencies=new List<string>() {"b"} },
                    new AppDef() { AppIdTuple = new AppIdTuple("m1", "d"), StartupOrder = -1, Dependencies=new List<string>() {"a"} },
                }
            );

            cl.BroadcastMessage( new LoadPlanMessage(plan1) );

            var messages = cl.ReadMessages();
            foreach( var msg in messages )
            {
                Console.WriteLine("Received: {0}", msg.ToString());

                if( msg.GetType() == typeof(LoadPlanMessage) )
                {
                    LoadPlanMessage m = msg as LoadPlanMessage;
                    Console.WriteLine("  LoadPlan '{0}' ({1} applications)", m.plan.Name, m.plan.getAppDefs().Count<AppDef>());
                }
            }
        }
        void Start()
        {
            _ultraschallSensoren = GameObject.FindGameObjectsWithTag("UltraschallSensor");

            foreach (GameObject sensor in _ultraschallSensoren) {
                //int val = sensor.GetComponent<UltraschallSensor>().value;
                //byte id = sensor.GetComponent<UltraschallSensor>().id;
                //values [id].value = val;
                //values [id].id = id;
                //(int)sensor.transform.position.x;
                //Instantiate(respawnPrefab, respawn.transform.position, respawn.transform.rotation);
            }
            //respawns = GameObject.FindGameObjectsWithTag("Respawn");

            //con = new Connector ();
            //con.fnConnectResult ("127.0.0.1", 25000, "bla");
            //con.testCon ("127.0.0.1", 25000);
            //cl = new Client ("127.0.0.1", 25000);

            /*
            values [0].id = 0;
            values [0].value = 444;
            values [1].id = 1;
            values [1].value = 333;
            values [2].id = 2;
            values [2].value = 9999;
            */

            //result = new byte[values.Length * _dataentry_t_size];
            //values.CopyTo (result, 0);
            //result = new byte[values.Length * _dataentry_t_size];
            //Buffer.BlockCopy(values, 0, result, 0, result.Length);

            _client = new Client("169.254.151.80", 25000);
        }
Beispiel #3
0
 void App_Startup(object sender, StartupEventArgs e)
 {
     Client ClientWindow = new Client();
     ClientWindow.Top = 100;
     ClientWindow.Left = 700;
     ClientWindow.Show();
 }
Beispiel #4
0
        static void Main(string[] args)
        {
            IPAddress remote = IPAddress.Parse("10.3.1.39");
            Client c = new Client(7777, remote);

            c.connect();
            Console.WriteLine("服务器连接成功!");
            while (true)
            {
                Console.Write("send>");
                string msg = Console.ReadLine();
                if (msg == "exit")
                    break;
                c.send(msg);
            }
            c.disconnect();
            Console.ReadLine();
        }
 public void SendDataToServer(IBaseMsg data)
 {
     if (gameData.CurrentMode == GameMode.MutiPlayer)//多人模式
     {
         if (_client == null)
         {
             ClientService clientService = GameObject.Find("NetClient").GetComponent <ClientService>();
             _client = clientService._client;
         }
         Debug.Log(_client);
         _client.SendMsg(data.ToJson());
     }
     else//单机模式
     {
         Debug.Log(data.ToJson());
         RemoteCMD_Data recData = LitJson.JsonMapper.ToObject <RemoteCMD_Data>(data.ToJson());
         GameObject.Find("PVEController").GetComponent <LocalService_View>().
         SendDataToLocal(recData);    //发送数据到本地
     }
 }
Beispiel #6
0
        static void Main(string[] args)
        {
            Application.Start(Environment.Exit);
            // This is extremely important to enable high throughput
            // of individual messages
            ServicePointManager.UseNagleAlgorithm = false;
            ServicePointManager.DefaultConnectionLimit = 48;

            var options = new ClientOptions();

            if (!Platform.CommandLine.CommandLineParser.Default.ParseArguments(args, options))
            {
                Console.WriteLine(options.GetUsage());
                return;
            }

            try
            {
                if (options.Command.Count == 0 && File.Exists("Readme.md"))
                {
                    Console.WriteLine(File.ReadAllText("Readme.md"));
                }

                foreach (var pair in options.GetPairs())
                {
                    Console.WriteLine("  {0,15} : {1}", pair.Key.ToUpperInvariant(), pair.Value);
                }
                Console.WriteLine();

                var client = new Client(options);
                client.Run();
            }
            catch (Exception exception)
            {
                Console.WriteLine("ERROR:");
                Console.Write(exception.Message);
                Console.WriteLine();
            }
        }
Beispiel #7
0
 static void Main(string[] args)
 {
     var client = new Client();
     client.Start();
     client.Send(null);
 }
Beispiel #8
0
 public CommandProcessorContext(Client client, ILogger log)
 {
     Log = log;
     Client = client;
 }
        static void Main(string[] args)
        {
            /*byte[] TestKey = new byte[] { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5 };
            byte[] TestSalt  = new byte[] { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5 };
            byte[] TestIV = new byte[] { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 2, 2, 2, 2, 3, 3, 3, 3 };

            byte[] encCode = new byte[0];
            byte[] decCode = new byte[0];
            WopEx.GenerateCryptoCode(123456, 15, ref encCode, ref decCode);

            WopEx wopEx = new WopEx(TestKey, TestSalt, TestIV, encCode, decCode, SecureSocketProtocol3.WopEncMode.Simple, 1);
            */

            //SysLogger.onSysLog += SysLogger_onSysLog;
            Console.Title = "SSP Client";
            Client client = new Client();

            /*int connections = 0;
            while(true)
            {
                new Client();
                Console.WriteLine("Connections: " + ++connections);
            }

            for(int i = 0; i < 4; i++)
            {
                new Thread(new ThreadStart(() =>
                {
                    while (true)
                    {
                        new Client();
                    }
                })).Start();
            }*/

            Process.GetCurrentProcess().WaitForExit();
        }