Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            int    port_r = 1100;
            string addr   = "0.0.0.0";
            ListenerBaseTcpListener listener_r = new ListenerBaseTcpListener(port_r, addr);
            Thread t_r = new Thread(new ThreadStart(listener_r.RunServer));

            t_r.Start();
            var stream_r = listener_r.GetNetworkStream();

            if (stream_r == null)
            {
                Console.Write("Waiting for a connection... ");
            }
            while (stream_r == null)
            {
                stream_r = listener_r.GetNetworkStream();
            }
            Console.WriteLine("Connected!");
            uRServerAction_right = new URServerAction(stream_r);



            ///////////////////////////////////////////////////////////////////////////////////////////

            int    port_l = 1101;
            string addr_l = "0.0.0.0";
            ListenerBaseTcpListener listener_l = new ListenerBaseTcpListener(port_l, addr_l);
            Thread t_l = new Thread(new ThreadStart(listener_l.RunServer));

            t_l.Start();
            var stream_l = listener_l.GetNetworkStream();

            if (stream_l == null)
            {
                Console.Write("Waiting for a connection... ");
            }
            while (stream_l == null)
            {
                stream_l = listener_l.GetNetworkStream();
            }
            Console.WriteLine("Connected!");
            uRServerAction_left = new URServerAction(stream_l);


            ///////////////////////////////////////////////////////////////////////////////////////////


            robotMakeDrinkControl = new RobotMakeDrinkControl(uRServerAction_left, uRServerAction_right);
        }
Exemplo n.º 2
0
 public RobotMakeDrinkControl(URServerAction uRServerActionLeft, URServerAction uRServerActionRight)
 {
     uRServerAction_left  = uRServerActionLeft;
     uRServerAction_right = uRServerActionRight;
 }