初学sockets 这个错误不知道怎么解决,请大家帮忙!
代码如下:
 /// <summary>
        /// 开始监听
        /// </summary>
        private void StartListen()
        {
            IPAddress ipAddress = Dns.GetHostEntry("localhost").AddressList[0];
            MyTcpListener = new TcpListener(ipAddress, 888);
            //开始监听
            MyTcpListener.Start();
            MessageBox.Show("Server Started!");
              
            //接受一个新的客户端
            TcpClient MyTcpClient = MyTcpListener.AcceptTcpClient();            while (true)
            {
                NetworkStream MyStream = MyTcpClient.GetStream();
                byte[] MyBytes = new byte[1024];                //MyByteRead要解码的字节数
                int MyBytesRead = MyStream.Read(MyBytes, 0, MyBytes.Length);
                string MyMessage = System.Text.Encoding.Default.GetString(MyBytes, 0, MyBytesRead);
                this.RTBClientMessage.Text += MyMessage;
            }
        }