This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Generic TCP Server for external requests
#5
I am testing UDP again to compare.

Matthieu

I had issues with 10+ UDP requests per second with the following code :

Code:
while true do
 message = udpserver:receive()

 -- got message from udp, send to all active clients
 if message then
   for id, sock in pairs(clients) do
     sock:send(message .. '\r\n')
   end
 end

 copas.step(0.1)
end

With this code, it's working better :
Code:
while true do
 message = udpserver:receive()

 while message do
 -- got message from udp, send to all active clients
   for id, sock in pairs(clients) do
     sock:send(message .. '\r\n')
   end
   message = udpserver:receive()
 end

 copas.step(0.1)
end

It does process the UDP queue at each iteration instead of one by one.
What do you think about it ?
Matthieu
Reply


Messages In This Thread
RE: Generic TCP Server for external requests - by Matt - 15.07.2015, 13:29

Forum Jump: