0

SOAP クライアントを作成しようとしています。しかし、このエラーが発生し続けます。理由はありますか?IPを変更してみましたが、それでも同じエラーです。

ここに画像の説明を入力

MulticastSocket.Java

  public void joinGroup(InetAddress mcastaddr) throws IOException {
    if (isClosed()) {
        throw new SocketException("Socket is closed");
    }

    checkAddress(mcastaddr, "joinGroup");
    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkMulticast(mcastaddr);
    }

    if (!mcastaddr.isMulticastAddress()) {
        throw new SocketException("Not a multicast address");
    }

SOAPClient.java

public class MultiThread extends Thread implements ActionListener, KeyListener {
    MulticastSocket socket;
    DatagramPacket packet;

    public MultiThread() throws IOException {
        socket = new MulticastSocket(4446);
        InetAddress group = InetAddress.getByName("122.57.153.213");
        socket.joinGroup(group);
    }

SOAPCLient.java @ 80 行目

public SoapClient() throws IOException, RemoteException, NotBoundException, NamingException {      
    setBackground(new Color(0, 153, 76));//three green lines on gui
    JPanel rightSideLayout = new JPanel();//active clients
    rightSideLayout.setBackground(Color.darkGray);    
    JPanel bottomPanel = new JPanel(new BorderLayout());//contains typing field and send button

    JLabel label = new JLabel();
    Font font = label.getFont();
    Map attributes = font.getAttributes();
    attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
    font  = Font.getFont(attributes);
    label.setFont(font);
    label.setText("\tBhoo Online");
    label.setForeground(Color.WHITE);

    setLayout(new BorderLayout(10, 10));

    sendButton = new JButton("Send");
    sendButton.setPreferredSize(new Dimension(RIGHT_PANEL_WIDTH, 20));
    line 80   sendButton.addActionListener(new MultiThread());
    mainField = new JTextArea();

SOAPClient.java (メイン)

    public static void main(String[] args) throws IOException, InterruptedException, RemoteException, NotBoundException, NamingException {
    JFrame frame = new JFrame("BhooChat Client");
    SoapClient bhooChat = new SoapClient();
    frame.add(bhooChat);
4

2 に答える 2

1

dbush が述べたように、122.57.1​​53.213 はマルチキャスト アドレスではありません。

224.0.0.1 は既知のアドレスです

224.0.0.69 ~ 224.0.0.100 は予約済み

http://www.iana.org/assignments/multicast-addresses/multicast-addresses.xhtml

239.192.0.1 のようなアドレスを試してください

于 2016-06-26T13:16:29.950 に答える