Ich versuche, einen SOAP-Client zu erstellen. aber behalte diesen Fehler immer. Irgendwelche Ideen warum? Ich habe versucht, die IP zu ändern, aber immer noch den gleichen Fehler.Multicasting-Fehler: Multicast-Adresse nicht gefunden
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 @ line 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 (Haupt
)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);
Vielen Dank für das, habe ich versucht, Ändern Sie es ein paar Mal, dh 224.0.0.1 & 224.0.0.100 und sagt dann, kann Adresse nicht zuweisen? wäre das, weil ich einen Mac verwende? @dbush – kiwilifter
@kiwilifter Es ist möglich, dass die Schnittstelle, an der versucht wird, zu verbinden, Multicast nicht zulässt. Rufen Sie vor dem Aufruf von 'joinGroup' zunächst' setInterface' auf und übergeben Sie ihm die IP der Schnittstelle, der Sie beitreten möchten. Führen Sie außerdem 'ifconfig -a' in der Befehlszeile aus, um zu sehen, welche Schnittstellen Multicast unterstützen und welche nicht. – dbush