SendFile() private method

private SendFile ( String relPath, Socket socket, String baseDir ) : MyFile
relPath String
socket System.Net.Sockets.Socket
baseDir String
return MyFile
Exemplo n.º 1
0
 private void processOutQueue()
 {
     if (outQueue.Count > 0)
     {
         sendCommandToClient(Signal.s2c);
         Common.SendFile(outQueue.Dequeue(), socket, dataDir); // TODO: check return value
         processOutQueue();
     }
 }
Exemplo n.º 2
0
        private void processOutQueue()
        {
            if (outQueue.Count > 0)
            {
                setStatus(ClientStatus.SYNCING);
                sendCommandToServer(Signal.c2s);
                MyFile myFile = Common.SendFile(outQueue.Dequeue(), socket, dataDir);
                if (myFile != null)
                {
                    fileIndex.Update(myFile); // TODO: perform this after server confirmation
                }
                processOutQueue();
            }

            setStatus(ClientStatus.READY);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Send catchup operation to the client based on the original inputOperation
 /// </summary>
 /// <param name="inputOperation">the initial operation for which to determine an output operation</param>
 /// <param name="arg">additional arguments for the input/output operation</param>
 public void SendCatchup(Signal inputOperation, String arg)
 {
     if (inputOperation == Signal.c2s)
     {
         try {
             Console.WriteLine("catchup s2c to client (" + handle + "): " + arg);
             if (File.Exists(dataDir + arg))
             {
                 sendCommandToClient(Signal.s2c);
                 Common.SendFile(arg, socket, dataDir);
             }
         }
         catch (Exception e) {
             Console.WriteLine("catchup s2c to client failed: " + e.Message);
         }
     }
     else if (inputOperation == Signal.deleteOnServer) // handles files and directories?
     {
         try {
             Console.WriteLine("catchup delete to client (" + handle + "): " + arg);
             sendCommandToClient(Signal.deleteOnClient);
             Common.SendString(socket, arg);
         }
         catch (Exception e) {
             Console.WriteLine("catchup delete to client failed: " + e.Message);
         }
     }
     else if (inputOperation == Signal.createDirectoryOnServer)
     {
         try {
             Console.WriteLine("catchup createDirectoryOnClient (" + handle + "): " + arg);
             sendCommandToClient(Signal.createDirectoryOnClient);
             Common.SendString(socket, arg);
         }
         catch (Exception e) {
             Console.WriteLine("catchup createDirectoryOnClient failed: " + e.Message);
         }
     }
     else
     {
         Console.WriteLine("unknown command: " + inputOperation);
     }
 }