B4J Question is the JNet -> UDPSocket library threaded ?

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
Hello everyone, does the JNet -> UDPSocket library use threaded ?
I'm creating an example of an online game, and it would be necessary for each connection to have its own thread to execute such functions...
 

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
Yes. Sending and receiving happens in the background.

Taking into account the following environment -> suppose there are 10 thousand users simultaneously, if you have hardware that can handle everything, does the server compute the data without freezing the functions in case 1 connection requires more data processing time than another?
(Do all other clients have to wait for this function to close before being able to continue requests from other connections?)
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Your code runs on the main thread. If it takes 2ms to process (which is a lot) then you will be able to serve about 500 requests per second.
500 requests per second = very busy website.

If you want to build a real server then use jServer. Each request will be handled by a different thread and it will be 1000 times more powerful.
 
Upvote 0

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
in this case, I would like to create a server for an online game, so I would like to understand more about UDPSocket limitations ... as the demand for an online game is very high (position x,y,z of the character, attack, deviation and the like)
with websocket in jServer can I have the same response ping?
 
Upvote 0

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
taking into account a game that requires a very agile response time, as we are dealing with a multiplayer game
so can i use jserver with websocket instead of a udp server?
if so, it will be amazing...
 
Upvote 0
Top