Esempio n. 1
0
 private void clientThread(TcpClient client)
 {
     file = Serialization.Serialize.readFromStream(client.GetStream());
     System.IO.File.WriteAllBytes(file.Name, file.Data);
     Console.WriteLine("File Received");
     client.Close();
 }
Esempio n. 2
0
        private static void openFileStream()
        {
            bool tryingToConnect = true;

            while (tryingToConnect)
            {
                path = "../../" + getFileName() + ".txt";
                try
                {
                    FileStream fileStream = File.OpenRead(path);
                    file            = new Serialization.File(path, File.ReadAllBytes(path));
                    tryingToConnect = false;
                }
                catch (FileNotFoundException)
                {
                    Console.WriteLine("Couldn't find file with path:" + path);
                }
            }
        }