网络调试助手app,使用局域网本地IP显示无效地址是什么原因?

我试图编写一个手机用的网络调试助手app,在编写客户端模式时可以正常连接,但编写服务器模式时无法实现。ip使用局域网本地ip显示无效地址,代码如下
public class Server
    {
        private static byte[] result = new byte[1024];
        //Socket server=null;
        public static string text1;
        public static string WifiListen()
        {
            //result = Encoding.UTF8.GetBytes("This is a test");
            IPAddress localip = IPAddress.Parse("192.168.0.106");
            Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            server.Bind(new IPEndPoint(localip, 57827));
            server.Listen(10);
            while (true)
            {
                Socket client = server.Accept();//这里跑不下去了                 
                client.Send(Server.result);
                Socket clientserver = client;
                while (true)
                {
                    try
                    {
                        int information = clientserver.Receive(result); //return text1;
                        text1 = "客户IP:" + clientserver.RemoteEndPoint.ToString();
                    }
                    catch (Exception ex)
                    {
                        clientserver.Shutdown(SocketShutdown.Both);
                        clientserver.Close();
                        text1 = "close";
                        break;
                    }
                }
                return text1;
            }
        }
    }

运行报错的情况如图上的注释
我试过网上的一些建议,用2.4和5的频段的局域网wifi都试过了,
我希望能够连上,并实现一个简单的数据发送功能。现在我猜测是不是由于防火墙的缘故,如果是防火墙的缘故应该怎样解决这个问题?

运行报错补充:代码段中的ip地址是我局域网给电脑分配的地址,ESP8266也连接在这个局域网中,但是使用这个ip地址会报错System.Net.Sockets.SocketException: 'The requested address is not valid in this context';如果使用0.0.0.0的ip地址不会报错,但是ESP仍旧无法连接,程序会在Accept()那个位置一直等待