Ejemplo n.º 1
0
        static int Main(string[] args)
        {
            if (args.Length < 2)
            {
                Usage();
                return 1;
            }

            if (args[0] == "-c")
            {
                SetChunkSizeAndPortIfNeeded(args, 2);
                Client client = new Client(args[1]);
                client.Download();
                return 0;
            }

            if (args[0] != "-s" || args.Length < 3)
            {
                Usage();
                return 1;
            }

            ServerMode mode;
            switch(args[1])
            {
                case "memory":
                    mode = ServerMode.Memory;
                    break;

                case "readsend":
                    mode = ServerMode.ReadSend;
                    break;

                case "transmitfile":
                    mode = ServerMode.TransmitFile;
                    break;

                default:
                    Usage();
                    return 1;
            }

            ServerData data = new ServerData();
            if (mode == ServerMode.Memory)
                data.SizeInMB = uint.Parse(args[2]);
            else
                data.FilePath = args[2];

            SetChunkSizeAndPortIfNeeded(args, 3);

            Server server = new Server(data);
            server.Run(mode);
            return 0;
        }
Ejemplo n.º 2
0
        static int Main(string[] args)
        {
            if (args.Length < 2)
            {
                Usage();
                return(1);
            }

            if (args[0] == "-c")
            {
                SetChunkSizeAndPortIfNeeded(args, 2);
                Client client = new Client(args[1]);
                client.Download();
                return(0);
            }

            if (args[0] != "-s" || args.Length < 3)
            {
                Usage();
                return(1);
            }

            ServerMode mode;

            switch (args[1])
            {
            case "memory":
                mode = ServerMode.Memory;
                break;

            case "readsend":
                mode = ServerMode.ReadSend;
                break;

            case "transmitfile":
                mode = ServerMode.TransmitFile;
                break;

            default:
                Usage();
                return(1);
            }

            ServerData data = new ServerData();

            if (mode == ServerMode.Memory)
            {
                data.SizeInMB = uint.Parse(args[2]);
            }
            else
            {
                data.FilePath = args[2];
            }

            SetChunkSizeAndPortIfNeeded(args, 3);

            Server server = new Server(data);

            server.Run(mode);
            return(0);
        }
Ejemplo n.º 3
0
 internal Server(ServerData data)
 {
     mData = data;
 }
Ejemplo n.º 4
0
 internal Server(ServerData data)
 {
     mData = data;
 }