Problem of UDPSocket on Windows

L

Lee youser

[Note: parts of this message were removed to make it a legal post.]

Hi, All:

I beg for your helps, my trouble as follow:

Background:
Use UDP socket to implement an C/S module, Client send messages and Server
receive these messages and print them.Client run

on Linux(RHEL 5.1) and Server run on Windows(XP).Thetwo computers are in
LAN.

Problem:
When client send a message,the server will receive this message after 4-5
seconds passed.It is a terrible delay!

Is there someone could tell me why? Is it a limitation on ruby UDPSocket(for
Windows)?


PS:
When the Server run on linux and the Client run on windows, the server can
receive messages immediately.
I tried to use C++ and Python to implement the Server, and it can receive
messages immediately too.

server.rb:

require 'socket'

socket = UDPSocket.new
socket.bind("192.168.1.101",6321)
loop do
msg,sender = socket.recvfrom(1024)
p msg
end

client.rb:

require 'socket'

socket = UDPSocket.new
port = 6321
host = "192.168.1.101"
socket.send(ARGV[0],0,host,port)
 
J

Joel VanderWerf

Lee said:
Hi, All:

I beg for your helps, my trouble as follow:

Background:
Use UDP socket to implement an C/S module, Client send messages and Server
receive these messages and print them.Client run

on Linux(RHEL 5.1) and Server run on Windows(XP).Thetwo computers are in
LAN.

Problem:
When client send a message,the server will receive this message after 4-5
seconds passed.It is a terrible delay!

Try putting this at the top of your windows code:

Socket.do_not_reverse_lookup = true

If that helps, then the problem has something to do with delay in DNS
lookup, converting numerical to symbolic addresses.

Just a guess :)
 
L

Lee youser

[Note: parts of this message were removed to make it a legal post.]

Joel :

Try putting this at the top of your windows code:

Socket.do_not_reverse_lookup = true


Thanks a lot :)

--
 

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,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top