Exemple #1
0
        public static void Main(string[] args)
        {
            TcpListener tcpListener = null;
            var         spreadsheetServiceServers = theSpreadsheetServiceServers;

            try
            {
                tcpListener = new TcpListener(IPAddress.Any, 1984);
                tcpListener.Start();
                Console.WriteLine("Now Listening");

                while (!Stop)
                {
                    var spreadsheetServiceServer = new SpreadsheetServiceServer(tcpListener.AcceptSocket());

                    if (spreadsheetServiceServer != null)
                    {
                        spreadsheetServiceServers[spreadsheetServiceServer.ID] = spreadsheetServiceServer;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: " + ex.Message);
                Console.ReadLine();
            }
            finally
            {
                if (tcpListener != null)
                {
                    tcpListener.Stop();
                }
            }

            return;
        }
Exemple #2
0
        internal static bool TryRemoveServer(SpreadsheetServiceServer spreadsheetServiceServer)
        {
            SpreadsheetServiceServer value;

            return(theSpreadsheetServiceServers.TryRemove(spreadsheetServiceServer.ID, out value));
        }