Hello everyone, today I took some time to test the udp socket flow in b4j.
I went to perform tests to see how isolated a connection is from the other in the udp socket, but I came across the following problem, unlike the Jserver Websocket, each connection is not "isolated" ...
that is, if one of the connected clients sends messages to the client without delay, this freezes the server so that it responds only to that client that is sending messages without control...
would there be any way to isolate each connection in the udp socket, similar to what is done in the jserver websocket handler?
my code >:
I left the udpclient, in case anyone is interested in testing, if you don't feel comfortable and safe running a third-party .exe, you can create any udp socket for testing ...
I went to perform tests to see how isolated a connection is from the other in the udp socket, but I came across the following problem, unlike the Jserver Websocket, each connection is not "isolated" ...
that is, if one of the connected clients sends messages to the client without delay, this freezes the server so that it responds only to that client that is sending messages without control...
would there be any way to isolate each connection in the udp socket, similar to what is done in the jserver websocket handler?
my code >:
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
Private udp As UDPSocket
End Sub
Sub AppStart (Args() As String)
Log("starts udp listener")
udp.Initialize("udp",6832,8192)
StartMessageLoop
End Sub
Sub udp_PacketArrived (Packet As UDPPacket)
Log($"${Packet.Port}"$)
Try
Dim s As String
s = BytesToString(Packet.Data, 0, Packet.Length, "UTF-8")
Log("Mensagem Recebida > "&s)
Log("-------------------------------------------------------------")
Catch
Log(LastException)
End Try
End Sub
I left the udpclient, in case anyone is interested in testing, if you don't feel comfortable and safe running a third-party .exe, you can create any udp socket for testing ...