HI All,
I am trying to receive the data from Multicast DNS . I see the data using Wireshark but I need to process the data. The IP for the multicast is 224.0.0.251 and port is 5353.
 
		
		
	
	
		 
	
I have tried this code
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
But I am getting this error, Have tried rebooting , any Ideas ? Thank you
UPDATE: I tried using
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
and checked on the broadcast address and it is using the incorrect IP. I do not see any way of forcing the correct IP
			
			I am trying to receive the data from Multicast DNS . I see the data using Wireshark but I need to process the data. The IP for the multicast is 224.0.0.251 and port is 5353.
I have tried this code
			
				B4X:
			
		
		
		#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 200
#End Region
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Dim UDPSocket1 As UDPSocket
    Private txtLogs As B4XView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
    UDPSocket1.Initialize("UDP", 5353, 8000)
End Sub
Sub UDP_PacketArrived (Packet As UDPPacket)
    Dim msg As String
    msg = BytesToString(Packet.Data, Packet.Offset, Packet.Length, "UTF8")
    Log("Message received: " & msg )
    UpdateLogs(msg)
End Sub
Sub UpdateLogs(strLog As String)
    DateTime.DateFormat = "yyyy-MM-dd HH:mm:ss"
    txtLogs.Text =  DateTime.Date(DateTime.now) & ": " & strLog & CRLF & txtLogs.Text
End SubBut I am getting this error, Have tried rebooting , any Ideas ? Thank you
main._appstart (java line: 58)
java.net.BindException: Address already in use: Cannot bind
at java.base/java.net.DualStackPlainDatagramSocketImpl.socketBind(Native Method)
at java.base/java.net.DualStackPlainDatagramSocketImpl.bind0(DualStackPlainDatagramSocketImpl.java:84)
at java.base/java.net.AbstractPlainDatagramSocketImpl.bind(AbstractPlainDatagramSocketImpl.java:131)
at java.base/java.net.DatagramSocket.bind(DatagramSocket.java:394)
at java.base/java.net.DatagramSocket.<init>(DatagramSocket.java:244)
at java.base/java.net.DatagramSocket.<init>(DatagramSocket.java:301)
at java.base/java.net.DatagramSocket.<init>(DatagramSocket.java:273)
at anywheresoftware.b4a.objects.SocketWrapper$UDPSocket.Initialize(SocketWrapper.java:352)
at b4j.example.main._appstart(main.java:58)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.start(main.java:37)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
UPDATE: I tried using
			
				B4X:
			
		
		
		UDPSocket1.Initialize2("UDP", 5353, 8000,True,False)and checked on the broadcast address and it is using the incorrect IP. I do not see any way of forcing the correct IP
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		