public void sendFile(FileSender data) { try { serialization.writeToStream(networkStream, data); } catch (SocketException ex) { } }
private void button1_Click_1(object sender, EventArgs e) { if (isSetFile) { using (FileStream fileStream = File.OpenRead(path)) { String filename = Path.GetFileName(path); byte[] data = File.ReadAllBytes(path); fileSender = new FileSender(filename, data); } client.sendFile(fileSender); labelSend.Text = "Wyslano"; } }