title: can't access socket because of its permission
body: <p>I'm using C# with visual studio 2010 on windows 7<br>
  just trying a simple server/ client example to learn about socket programming for like 2 weeks now but then yesterday when I started debugging I got this exception (An attempt was made to access a socket in a way forbidden by its access permission). even though I've turned off the firewall and anti virus. plus checked the security tab and set full trust  .</p>
  
  <p>I read many articles saying we can't use TCP on windows 7 but it was working alright ! and it still works , I just need to restart the computer . but restarting every time I need to run is not a solution .</p>
  
  <p>any ideas??</p>
  
  <p>update:</p>
  
  <pre><code>static void Main(string [] args)
      {
          Program progDomain = new Program();
          progDomain.clients = new List&lt;ClientManager&gt;();
  
          if ( args.Length == 0 )
          {
              progDomain.serverPort = 8000;
              progDomain.serverIP = IPAddress.Any;
          }
          if ( args.Length == 1 )
          {
              progDomain.serverIP = IPAddress.Parse(args [0]);
              progDomain.serverPort = 8000;
          }
          if ( args.Length == 2 )
          {
              progDomain.serverIP = IPAddress.Parse(args [0]);
              progDomain.serverPort = int.Parse(args [1]);
          }
  
          progDomain.bwListener = new BackgroundWorker();
          progDomain.bwListener.WorkerSupportsCancellation = true;
          progDomain.bwListener.DoWork += new DoWorkEventHandler(progDomain.StartToListen);
          progDomain.bwListener.RunWorkerAsync();
  
          Console.WriteLine("*** Listening on port {0}{1}{2} started.Press ENTER to shutdown server. ***\n",progDomain.serverIP.ToString(),":",progDomain.serverPort.ToString());
  
          Console.ReadLine();
  
          progDomain.DisconnectServer();
      }
  
      private void StartToListen(object sender , DoWorkEventArgs e)
      {
          this.listenerSocket = new Socket(AddressFamily.InterNetwork , SocketType.Stream , ProtocolType.Tcp);
          this.listenerSocket.Bind(new IPEndPoint(this.serverIP , this.serverPort));
          this.listenerSocket.Listen(200);
          while ( true )
              this.CreateNewClientManager(this.listenerSocket.Accept());
      }
  </code></pre>
  
  <p>here's the piece of code where the exception fires. nothing much since it fires right from the start.</p>