I can not initialize a multicast server to intercept the presence of my application in any network.
Does anyone have a solution to solve the problem?
These are the messages that I see in debug.
myAddr : (Inet4Address) /231.0.0.3
server : (MulticastSocket) java.net.MulticastSocket@5451c3a8
main._initializewithip (java line: 75)
java.lang.RuntimeException: Field: joinGroup not found in: java.net.MulticastSocket
at anywheresoftware.b4j.object.JavaObject$FieldCache.getField(JavaObject.java:306)
at anywheresoftware.b4j.object.JavaObject.SetField(JavaObject.java:173)
at b4j.example.main._initializewithip(main.java:75)
at b4j.example.main._appstart(main.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at b4j.example.main.main(main.java:29)
tnx


pixet
Does anyone have a solution to solve the problem?
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
Dim mucast As ServerSocket
Dim packet As UDPPacket
Private eotTimer As Timer
Private mAddress As String = "231.0.0.3"
Private msg As String = "Hello"
End Sub
Sub AppStart (Args() As String)
InitializeWithIp(mucast, "Multicast", 9901, mAddress)
'
StartMessageLoop
End Sub
Sub InitializeWithIp(Server As ServerSocket, EventName As String, Port As Int, ip As String)
Server.Initialize(0, EventName)
Dim myaddr As JavaObject
myaddr = myaddr.InitializeStatic("java.net.InetAddress").RunMethod("getByName", Array(ip))
Log("myAddr : " & myaddr)
Dim ms As JavaObject = Server
Dim msocket As JavaObject
msocket.InitializeNewInstance("java.net.MulticastSocket", Array(Port))
'.InitializeNewIstance("java.net.MulticastSocket", Array(Port))
Log(" server : " & msocket)
msocket.SetField("joinGroup", myaddr)
End Sub
These are the messages that I see in debug.
myAddr : (Inet4Address) /231.0.0.3
server : (MulticastSocket) java.net.MulticastSocket@5451c3a8
main._initializewithip (java line: 75)
java.lang.RuntimeException: Field: joinGroup not found in: java.net.MulticastSocket
at anywheresoftware.b4j.object.JavaObject$FieldCache.getField(JavaObject.java:306)
at anywheresoftware.b4j.object.JavaObject.SetField(JavaObject.java:173)
at b4j.example.main._initializewithip(main.java:75)
at b4j.example.main._appstart(main.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at b4j.example.main.main(main.java:29)
tnx
pixet