Page 2 of 2

Re: UDP Local Network Short Text Sending (All OS)

Posted: Fri Sep 29, 2023 8:41 pm
by RichAlgeni
The packets should be delivered whole, but I don't think you can count on only getting just one packet per read. You are using start and end bytes, so that should help distinguish the packets just in case. One more thing you could do is add a length in bytes field, or pad out the packet to a consistent size.

Just a couple of thoughts.

Re: UDP Local Network Short Text Sending (All OS)

Posted: Sat Sep 30, 2023 1:15 am
by mk-soft
RichAlgeni wrote: Fri Sep 29, 2023 8:41 pm The packets should be delivered whole, but I don't think you can count on only getting just one packet per read. You are using start and end bytes, so that should help distinguish the packets just in case. One more thing you could do is add a length in bytes field, or pad out the packet to a consistent size.

Just a couple of thoughts.
Not required here, as the receive data is separated by start and end characters, regardless of how it arrives.
Otherwise see module NetworkTCP

Re: UDP Local Network Short Text Sending (All OS)

Posted: Fri Oct 13, 2023 1:00 am
by skinkairewalker
I'm using this client to test the amount of load the server is supporting...
every 10ms, the 300 clients send a message to the server, until it supports it... but if I increase this number to 350, 400, n+...
It is already overloaded and clients are no longer able to perform basic functions, such as logging in for example.
Could it be a limitation of my hardware?
Or does the server really have this limitation on the number of connections per second?

start_udpclient.bat

Code: Select all

@echo off
set "executable=client_udp.exe"

for /l %%x in (1,1,300) do (
  start "" "%executable%"
)

exit
udpclient.pb

Code: Select all

Port = 6833
*Buffer = AllocateMemory(2048)

evnt.i = 0
ConnectionID = OpenNetworkConnection("127.0.0.1", Port,#PB_Network_UDP)
If ConnectionID
  OpenConsole("pain test")
  Repeat
    
    evnt = NetworkClientEvent(ConnectionID)
    
    Select evnt

        Case #PB_NetworkEvent_Data
          ReceiveNetworkData(ConnectionID, *Buffer, 2048)
          PrintN("String: "+PeekS(*Buffer, -1, #PB_UTF8|#PB_ByteLength))

    EndSelect    
    
    SendNetworkString(ConnectionID, #STX$ + "LifeTrigger udp new 10ms" + #ETX$, #PB_UTF8)
    Delay(10)
    
  ForEver
  ;CloseNetworkConnection(ConnectionID)
Else
  MessageRequester("PureBasic - Client", "Can't find the server (Is it launched ?).", 0)
EndIf

End

Re: UDP Local Network Short Text Sending (All OS)

Posted: Fri Oct 13, 2023 5:27 pm
by mk-soft
Calculate the data load per second.

Re: UDP Local Network Short Text Sending (All OS)

Posted: Tue Oct 17, 2023 12:01 am
by skinkairewalker
How would I do this?
because in theory what would be the limitation?
number of available ports, hardware, limitation of the socket itself...
I can't find a way... xD


A potential solution would be to create a processing queue on the server??

Re: UDP Local Network Short Text Sending (All OS)

Posted: Tue Oct 17, 2023 9:01 am
by mk-soft
Windows is not a real-time operating system.
In addition, many other protocols run over the network card that the operating system must process and distribute.
Then the server must also correctly allocate the 300 clients and store and report the 30000 received data per second.
So the server processes every 0,033 milliseconds a packet.
In your example as a local host, that is over 60000 UDP packets per second.

Re: UDP Local Network Short Text Sending (All OS)

Posted: Tue Oct 17, 2023 12:23 pm
by skinkairewalker
What do you advise doing to make the server handle more than 10,000 connected users in an MMORPG Or applications that need to be critical with a high message demand??

Re: UDP Local Network Short Text Sending (All OS)

Posted: Tue Oct 17, 2023 12:53 pm
by mk-soft
So it's not so easy with one server with Purebasic.
For this you need several servers with multiserver management with load distribution.

Re: UDP Local Network Short Text Sending (All OS)

Posted: Tue Oct 17, 2023 5:48 pm
by skinkairewalker
Would creating server instances on several different ports as if they were "channels" be a temporary solution?

and how would you measure the message load per second or millisecond?

Re: UDP Local Network Short Text Sending (All OS)

Posted: Tue Oct 17, 2023 6:41 pm
by mk-soft
I am not a gamer server high performans programmer.
Besides, this is the wrong place to clarify this.
Please create a new request.

Re: UDP Local Network Short Text Sending (All OS)

Posted: Tue Oct 17, 2023 7:07 pm
by skinkairewalker
I will do that, thank you very much!