public static void Run(Repo localRepo) { Stream stdin = Console.OpenStandardInput (); Stream stdout = Console.OpenStandardOutput (); PipeServer s = new PipeServer (stdin, stdout, localRepo); s.Run (); }
public static void Run(Repo localRepo) { Stream stdin = Console.OpenStandardInput(); Stream stdout = Console.OpenStandardOutput(); PipeServer s = new PipeServer(stdin, stdout, localRepo); s.Run(); }
public static void ParseCommand(string[] args) { if (args.Length == 0) { throw new HelpException("Missing command argument"); } KeyStorage keyStorage = KeyStorage.Default; switch (args [0].ToLower()) { case "list": List.Main(args, keyStorage); break; case "put": Put.Main(args, keyStorage); break; case "get": Get.Main(args, keyStorage); break; case "keys": Keys.Main(args, keyStorage); break; //Serve a single repo via the pipe //Usually via a remote ssh connection case "pipe": Repo pr = Repo.Create(args [1]); PipeServer.Run(pr); break; //Listen to localhost and serve a single repo //Used for debugging case "tcp": Repo tr = Repo.Create(args [1]); TcpServer.Run(tr); break; case "test": Test.Main(args, keyStorage); break; default: throw new HelpException("Unknown command: " + args [0]); } }
public static void Run(Repo repo) { TcpListener listener = new TcpListener(IPAddress.Loopback, PipeRepo.DefaultTcpPort); listener.Start(); Console.WriteLine("Listening on " + listener.LocalEndpoint); while (true) { TcpClient c = listener.AcceptTcpClient(); Console.WriteLine("Incoming from " + c.Client.RemoteEndPoint); NetworkStream s = c.GetStream(); PipeServer p = new PipeServer(s, s, repo); Thread t = new Thread(p.Run); t.Start(); } }