private void button2_Click(object sender, EventArgs e) { IPAddress ipaddress = IPAddress.Parse(tb_ip.Text); SocketConfig config = new SocketConfig(tb_otd.Text, ipaddress, 5555, 3000); BackupClient backupClient = new BackupClient(config); if (backupClient.Connect()) { Thread thread = new Thread(new ParameterizedThreadStart(BackupClient.SendAllFilesFromFolder)); thread.Start(Properties.Settings.Default.path); } else { MessageBox.Show("неудачное подключение"); } }
public BackupClient(Object objconfig) { config = (SocketConfig)objconfig; EndPoint = new IPEndPoint(config.ip, config.port); socket = new Socket(EndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); }