C#Client Side try { tcp = new TcpClient(); tcp.Connect(new IPEndPoint(IPAddress.Parse(Tbox_Ip.Text), int.Parse(TBox_Prot.Text))); //tcp.Connect(Tbox_Ip.Text, int.Parse(TBox_Prot.Text)); stream = tcp.GetStream(); data = new Data(); backgroundWorker1.WorkerSupportsCancellation = false; backgroundWorker1.RunWorkerAsync(); backgroundWorker2.WorkerSupportsCancellation = false; backgroundWorker2.RunWorkerAsync(); } catch (Exception ex) { MessageBox.Show(ex.Message); }
C#server side try { //Tls = new TcpListener(IPAddress.Parse(Tbox_Ip.Text), int.Parse(TBox_Prot.Text)); Tls = new TcpListener(IPAddress.Any, int.Parse(TBox_Prot.Text)); Tls.Start(); tcp = Tls.AcceptTcpClient(); stream = tcp.GetStream(); data = new Data(); backgroundWorker1.WorkerSupportsCancellation = false; backgroundWorker1.RunWorkerAsync(); backgroundWorker2.WorkerSupportsCancellation = false; backgroundWorker2.RunWorkerAsync(); } catch (Exception ex) { MessageBox.Show(ex.Message); }