home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2005 June (DVD) / DPPRO0605DVD.iso / dotNETSDK / SETUP.EXE / netfxsd1.cab / server_cs_6________.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Encoding:
Text File  |  2002-04-20  |  2.0 KB  |  61 lines

  1. /*=====================================================================
  2.  
  3.   File:      server.cs
  4.  
  5. ---------------------------------------------------------------------
  6. This file is part of the Microsoft .NET Framework SDK Code Samples.
  7.  
  8.   Copyright (C) Microsoft Corporation.  All rights reserved.
  9.  
  10. This source code is intended only as a supplement to Microsoft
  11. Development Tools and/or on-line documentation.  See these other
  12. materials for detailed information regarding Microsoft code samples.
  13.  
  14. THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  15. KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  16. IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  17. PARTICULAR PURPOSE.
  18. =====================================================================*/
  19.  
  20. using System;
  21. using System.Collections;
  22. using System.Globalization;
  23. using System.Runtime.Remoting;
  24. using System.Runtime.Remoting.Channels;
  25. using System.Runtime.Remoting.Channels.Http;
  26. using System.Threading;
  27.  
  28. using IPFilter;
  29.  
  30.  
  31. public class Server
  32. {
  33.     public static void Main(String[] args)
  34.     {
  35.         RemotingConfiguration.Configure("channels.config");
  36.         RemotingConfiguration.Configure("server.exe.config");
  37.         
  38.         Console.WriteLine("Listening...");
  39.  
  40.         // obtain filter interface
  41.         IDictionary properties = 
  42.             ((HttpServerChannel)ChannelServices.GetChannel("MyHttpChannel")).Properties;
  43.         IFilterSink filterSink = (IFilterSink)properties[typeof(FilterSinkKey)];
  44.  
  45.         // print out filter sink information
  46.         Console.WriteLine("Mode: " + filterSink.Mode.ToString());
  47.         foreach (IFilter filter in filterSink.Filters)
  48.         {
  49.             Console.WriteLine("Mask: " + filter.Mask + "  IP: " + filter.IP);
  50.         }
  51.         
  52.         String keyState = "";
  53.         while (String.Compare(keyState,"0", true,CultureInfo.InvariantCulture) != 0)
  54.         {
  55.             Console.WriteLine("***** Press 0 to exit this service *****");
  56.             keyState = Console.ReadLine();
  57.         }
  58.     }
  59. }
  60.  
  61.