解决方案 »

  1.   

                byte[] bytes =new byte [20000];
                Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                listener.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1); 
               IPEndPoint LocalPoint = new IPEndPoint(System.Net.IPAddress.Parse("xxx.xxx.xxx.xxx"), port);
                listener.Bind(LocalPoint);
               while(true){
                int NumGet = listener.Receive(bytes);
                Msg = Encoding.Unicode.GetString(bytes, 0, NumGet);
    ...
                 }
      

  2.   

    还是一样,里面一直会出现这样一个异常,执行到int NumGet = listener.Receive(bytes);就跳出了线程。