以下是接收方的部分代码:
   public MultiCastReceiver(String[] args) {
      DatagramPacket mulcastPacket; // Packet to receive.
      byte[] mulcastBuffer; // byte[] array buffer
      InetAddress fromIP; //file:// Sender address.
      int fromPort; // Sender port.
      String mulcastMsg; // String of message.
      try {
         // First, set up your receiving socket.
         mulcastIP = InetAddress.getByName(args[0]);
         mulcastPort = Integer.parseInt(args[1]);
         mulcastSocket = new MulticastSocket(mulcastPort);
         // Join the multicast group.
         mulcastSocket.joinGroup(mulcastIP);
      } catch(UnknownHostException excpt) {
         System.err.println("Unknown address: " + excpt);
         System.exit(1);
      } catch(IOException excpt) {
         System.err.println("Unable to obtain socket: " + excpt);
         System.exit(1);
      }
并且,在WINDOWS下,传输中文,老是只传输部分内容。