From: Joel VanderWerf Date: 2006-06-21T04:56:20+09:00 Subject: Re: How to get the response from a UDP socket. Francis Cianfrocca wrote: > Joel: > So you think that all of the OP's code is client-side code? And he's just > using the word "server_thread" to indicate that he's looking for a response > on that thread, not that it's on the server? Just my guess... > If that's true, then he can dispense with the thread, the bind and the > connect, provided he knows how the "device" is sending a response packet to > him. Many services that accept UDP requests will return responses to the > same address and port that the requests came from. (This is usually an > ephemeral port.) Some services (like NTP) send responses to a well-known > port, to which the client must bind. Assuming the former, this code should > work: > > u = UDPSocket.new > u.send( "UDP Message", 0, server_ip_address, server_port) > response = u.recv(4096) That's a good point, but the OP seemed to have a fixed port in mind that the remote socket would reply to (port 5000). Maybe the remote process doesn't use the sender's address. I can only guess... -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407