Ejemplo n.º 1
0
        public static void Main(String[] args)
        {
            try
            {
                Int32 port           = GetValue(args, 0, DEFAULT_PORT);
                Int32 numConnections = GetValue(args, 1, DEFAULT_NUM_CONNECTIONS);
                Int32 bufferSize     = GetValue(args, 2, DEFAULT_BUFFER_SIZE);

                SocketListener sl = new SocketListener(numConnections, bufferSize);
                sl.Start(port);

                Console.WriteLine("Server listening on port {0}. Press any key to terminate the server process...", port);
                Console.Read();

                sl.Stop();
            }
            catch (IndexOutOfRangeException)
            {
                PrintUsage();
            }
            catch (FormatException)
            {
                PrintUsage();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        public static void Main(String[] args)
        {
            try
            {
                Int32 port = GetValue(args, 0, DEFAULT_PORT);
                Int32 numConnections = GetValue(args, 1, DEFAULT_NUM_CONNECTIONS);
                Int32 bufferSize = GetValue(args, 2, DEFAULT_BUFFER_SIZE);

                SocketListener sl = new SocketListener(numConnections, bufferSize);
                sl.Start(port);

                Console.WriteLine("Server listening on port {0}. Press any key to terminate the server process...", port);
                Console.Read();

                sl.Stop();

            }
            catch (IndexOutOfRangeException)
            {
                PrintUsage();
            }
            catch (FormatException)
            {
                PrintUsage();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Ejemplo n.º 3
0
        static void Main(String[] args)
        {
            try
            {
                SocketListener listener = new SocketListener(DEFAULT_MAX_NUM_CONNECTIONS, DEFAULT_BUFFER_SIZE);
                listener.Start(new IPEndPoint(IPAddress.Parse("127.0.0.1"), DEFAULT_PORT));

                Console.WriteLine("Server listening on port {0}. Press any key to terminate the server process...", DEFAULT_PORT);
                Console.Read();

                listener.Stop();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Ejemplo n.º 4
0
        static void Main(String[] args)
        {
            try
            {
                SocketListener listener = new SocketListener(DEFAULT_MAX_NUM_CONNECTIONS, DEFAULT_BUFFER_SIZE);
                listener.Start(new IPEndPoint(IPAddress.Parse("127.0.0.1"), DEFAULT_PORT));

                Console.WriteLine("Server listening on port {0}. Press any key to terminate the server process...", DEFAULT_PORT);
                Console.Read();

                listener.Stop();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }