title: Socket Exception error
body: <p>I have a networking socket program in C#.net.
  I have to connect with an ip: 169.254.74.65 and port:7998 and my ip is:169.254.74.63.
  So I have this code: </p>
  
  <pre><code>using System;
  using System.Net;
  using System.Net.Sockets;
  
  class MyTcpListener{
     public static void Main(){
         TcpListener server = null;
           try{
               Int32 port = 7998;
               IPAddress localAddr = IPAddress.Parse("169.254.74.65");
               server = new TcpListener(localAddr, port);
               server.Start();
               Byte[] bytes = new Byte[500];
               String data = null;
               while (true){
               Console.Write("Waiting for a connection... ");
               TcpClient client = server.AcceptTcpClient();
               data = null;
               NetworkStream stream = client.GetStream();
               int i;
               while ((i = stream.Read(bytes, 0, bytes.Length)) != 0){
               data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
               Console.WriteLine("Received: {0}", data);
               }
               client.Close();}
            }
          catch (SocketException e){
          Console.WriteLine("SocketException: {0}", e);}
          finally{ server.Stop();  }
  </code></pre>
  
  <p>Ping works fine between two IPs. Even telnet 169.254.74.65 7998 gives me proper result and listens to the correct messages. So the connection is solid. 
  But when I run the above code it shows an exception:</p>
  
  <pre><code>&gt; SocketException: System.Net.Sockets.SocketException (0x80004005): The requested address is not valid in its context
     at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
     at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
     at System.Net.Sockets.Socket.Bind(EndPoint localEP)
     at System.Net.Sockets.TcpListener.Start(Int32 backlog)
     at System.Net.Sockets.TcpListener.Start()
     at MyTcpListener.Main() in C:\Users\Administrator\source\repos\TCPListener\TCPListener\Program.cs:line 12
  </code></pre>
  
  <p>What is the problem here?</p>