Exemplo n.º 1
0
        public static int Main(string[] /*!*/ args)
        {
            int start = -1;

            if (args.Length < 4 + start)
            {
                Usage();
                return(1);
            }

            ushort port;

            try {
                port = UInt16.Parse(args[1 + start]);
            }
            catch (FormatException) {
                Console.WriteLine("Malformed port number: {0}", args[1 + start]);
                return(-1);
            }
            catch (OverflowException) {
                Console.WriteLine("Port number out of range: {0}", args[1 + start]);
                return(-1);
            }

            uint numBytes;

            try {
                numBytes = UInt32.Parse(args[2 + start]);
            }

            catch (FormatException) {
                Console.WriteLine("Malformed number of bytes: {0}", args[2 + start]);
                return(-1);
            }
            catch (OverflowException) {
                Console.WriteLine("Byte count out of range: {0}", args[2 + start]);
                return(-1);
            }

            uint chunkSize;

            try {
                chunkSize = UInt32.Parse(args[3 + start]);
            }
            catch (FormatException) {
                Console.WriteLine("Malformed chunk size: {0}", args[3 + start]);
                return(-1);
            }
            catch (OverflowException) {
                Console.WriteLine("Chunk size out of range: {0}", args[3 + start]);
                return(-1);
            }
            BlastServer bs = new BlastServer(port, numBytes, chunkSize);

            bs.Listen();
            bs.Shutdown();
            return(0);
        }
Exemplo n.º 2
0
        internal static int AppMain(Parameters !config)
        {
            if (config.port > 65536 || config.port < 0)
            {
                Console.WriteLine("Port number out of range: {0}", config.port);
                return(-1);
            }

            ushort      port      = (ushort)config.port;
            uint        numBytes  = (uint)config.numBytes;
            uint        chunkSize = (uint)config.chunkSize;
            BlastServer bs        = new BlastServer(port, numBytes, chunkSize);

            bs.Listen();
            bs.Shutdown();
            return(0);
        }