网上找的例子,我在本地计算机开启多个是可以通信,但是在局域网中的另一台机器就是不能接受或发送到我本机上,即不同机器二者不能相互通信,不知道各位是否砬到过,希望大家帮我看下,如能解决,可以现金酬谢,不胜感激!!
import java.net.*;
import java.awt.event.*;
import java.awt.*;
import java.io.*;
import javax.swing.*;
public class MutilCast {
public static void main(String[] args)
{
MulticastSocket s = null;
InetAddress group = null;
JPanel northPanel =new JPanel();
JPanel southPanel =new JPanel();
JPanel namePanel =new JPanel(new FlowLayout());
JLabel sendLabel =new JLabel("发送内容:");
JLabel nameChangeLabel =new JLabel("给自己起个名字:");
final JTextField nameSpace =new JTextField(20);
final JTextArea messageArea =new JTextArea("",20,20);
final JTextField sendField =new JTextField(30);
JScrollPane message =new JScrollPane(messageArea);
JButton sendButton =new JButton("发送");
JButton saveButton =new JButton("保存记录");
JButton clearUpButton =new JButton("清空面板");
Box centerBox =Box.createVerticalBox();