P Pfanne New Member Licensed User Longtime User Jul 1, 2012 #1 Hi, i try to start a UDP-Server in listening-mode, but the port is not open. Code: Copy Sub Process_Globals Dim UDPSocket2 As ServerSocket End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("main") If FirstTime Then UDPSocket2.Initialize(33333, "UDP") End If End Sub Sub Activity_Resume UDPSocket2.Listen End Sub Sub UDP_PacketArrived (Packet As UDPPacket) If Packet.Port = 33333 Then Log("33333") End Sub What did i wrong? Thanks for yor help. Greetings from germany Pf@nne
Hi, i try to start a UDP-Server in listening-mode, but the port is not open. Code: Copy Sub Process_Globals Dim UDPSocket2 As ServerSocket End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("main") If FirstTime Then UDPSocket2.Initialize(33333, "UDP") End If End Sub Sub Activity_Resume UDPSocket2.Listen End Sub Sub UDP_PacketArrived (Packet As UDPPacket) If Packet.Port = 33333 Then Log("33333") End Sub What did i wrong? Thanks for yor help. Greetings from germany Pf@nne
Erel B4X founder Staff member Licensed User Longtime User Jul 1, 2012 #2 Packet.Port returns the port in the device that sent the packet. It can be any number. Upvote 0
P Pfanne New Member Licensed User Longtime User Jul 1, 2012 #3 Hi Erel, thanks for your answer. Packet.Port returns the port in the device that sent the packet Click to expand... OK, but in Wireshark i see that port 33333 ist not reachable. If i send UDP to port 33333 nothing happends. This schould be show all recheived Data on ervery Port, isent it? Code: Copy Sub UDP_PacketArrived (Packet As UDPPacket) Dim msg As String msg = BytesToString(Packet.Data, Packet.Offset, Packet.Length, "UTF8") Msgbox("Message received: " & msg, "") End Sub Is my code in post #1, to open a UDP-Server in listenig mode on port 33333 OK? Thanks for your Help Pf@nne Upvote 0
Hi Erel, thanks for your answer. Packet.Port returns the port in the device that sent the packet Click to expand... OK, but in Wireshark i see that port 33333 ist not reachable. If i send UDP to port 33333 nothing happends. This schould be show all recheived Data on ervery Port, isent it? Code: Copy Sub UDP_PacketArrived (Packet As UDPPacket) Dim msg As String msg = BytesToString(Packet.Data, Packet.Offset, Packet.Length, "UTF8") Msgbox("Message received: " & msg, "") End Sub Is my code in post #1, to open a UDP-Server in listenig mode on port 33333 OK? Thanks for your Help Pf@nne
Erel B4X founder Staff member Licensed User Longtime User Jul 2, 2012 #4 You should use UDPSocket. Not ServerSocket. See the example in the manual: Basic4android - Network Upvote 0
P Pfanne New Member Licensed User Longtime User Jul 2, 2012 #5 Hello Erel, i also use the UDP-Socket to send UDP-Data and receive the response from the far server. I think the used UDP-Socket is, after sending, only a limeted time in listenig (Server) Mode on the random Port How to set the UDP-Socket permanent in listening Mode on Port xxxxx? Greets Pf@nne Last edited: Jul 2, 2012 Upvote 0
Hello Erel, i also use the UDP-Socket to send UDP-Data and receive the response from the far server. I think the used UDP-Socket is, after sending, only a limeted time in listenig (Server) Mode on the random Port How to set the UDP-Socket permanent in listening Mode on Port xxxxx? Greets Pf@nne
Erel B4X founder Staff member Licensed User Longtime User Jul 2, 2012 #6 UDPSocket stays open until you close it. Upvote 0
P Pfanne New Member Licensed User Longtime User Jul 2, 2012 #7 Hi Erel, of course you were absolutely right! But my port 33333 is only in my home-LAN reachable. With dissabled WLAN the port is over the WAN, by using the current mobile IP, not reachable. As I said, after sending a UDP i received Data on the random send-port over the WAN. It seams that there is any thing like a firewall.... Do you have a idea what i do wrong....... Thanks for your quick support greets from germany Pf@nne Upvote 0
Hi Erel, of course you were absolutely right! But my port 33333 is only in my home-LAN reachable. With dissabled WLAN the port is over the WAN, by using the current mobile IP, not reachable. As I said, after sending a UDP i received Data on the random send-port over the WAN. It seams that there is any thing like a firewall.... Do you have a idea what i do wrong....... Thanks for your quick support greets from germany Pf@nne
Erel B4X founder Staff member Licensed User Longtime User Jul 3, 2012 #8 Most mobile network providers block incoming connections (as well as many ports). I don't think that you will be able to use such a solution over mobile network. Upvote 0
Most mobile network providers block incoming connections (as well as many ports). I don't think that you will be able to use such a solution over mobile network.