Hi,
i've tried to do a little program that when detect a request then send a string to device.
This app can receive the data but don't send. How can i fix it?
But, if i execute my equivalent version in C# works like a charm. Then thats not a network problem.
I'm using:
Please advise
i've tried to do a little program that when detect a request then send a string to device.
This app can receive the data but don't send. How can i fix it?
But, if i execute my equivalent version in C# works like a charm. Then thats not a network problem.
I'm using:
B4X:
C:\Program Files (x86)\Java\jdk1.7.0_71\bin\javac.exe
B4X:
B4J 3.50
JavaObject 2.02
jCore 3.50
jFX 3.50
jNetwork 1.11
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim UDPSocket1 As UDPSocket
Dim jip As ServerSocket 'ignore
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.SetFormStyle("UNIFIED")
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
'MainForm.Show
UDPSocket1.Initialize("UDP", 8888, 8000)
Log("Local IP:" & jip.GetMyIP)
End Sub
Sub UDP_PacketArrived (Packet As UDPPacket)
Log ("Request from:" & Packet.HostAddress)
If Packet.HostAddress <> jip.GetMyIP Then
Log("Send response: " & Packet.HostAddress)
Dim Packet As UDPPacket
Dim dest As String
Dim data() As Byte
data = "CONTROLLER".GetBytes("UTF8")
dest = "255.255.255.255"
Packet.Initialize(data, dest, 8888)
UDPSocket1.Send(Packet) '<-- this line do nothing...
End If
End Sub
Please advise
Attachments
Last edited: