UDP socket delay

R

Roeland Moors

I'm trying to recieve syslog messages under windows.
This code works, but it takes about 5 seconds to recieve the message.
---8<---
require 'socket'

thread = Thread.new do
socket = UDPSocket.new
socket.bind('', 514)
while true
if IO.select([socket], nil, nil, 0)
p socket.recvfrom(1024)
break
end
end
end

thread.join
---8<---
I also tested other non-ruby programs and they seem to recieve this faster.
Can I speed things up, or is this normal?

Roeland
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top