Displaying 3 results from an estimated 3 matches for "open_datagram_socket".
2008 Jan 06
5
Having very odd problems with UDP.
....
class EchoServer
def receive_data data
puts data
send_data ">>>you sent: #{data}"
if data =~ /quit/i
puts "quitting"
close_connection
EventMachine::stop_event_loop
end
end
end
EventMachine::run {
EventMachine::open_datagram_socket "127.0.0.99", port, EchoServer
}
Gives the error
d:/ruby/lib/ruby/gems/1.8/gems/eventmachine-0.8.1-x86-mswin32/lib/eventmachine.rb:959:in
`event_callback'': EventMachine::ConnectionNotBound
(EventMachine::ConnectionNotBound)
from d:/ruby/lib/ruby/gems/1.8/gems/eventmachi...
2007 Nov 15
3
0-length datagram
...ears to be a problem with sending 0-length (UDP) datagrams. I
have a little UDP server running on port 1392, and when I execute the
following client code the server does not receive anything. However if I
change it to data="x", the server receives it just fine.
EM::run {
conn = EM::open_datagram_socket( "", 0 )
data = ""
puts "send_datagram( #{data.inspect} )"
conn.send_datagram( data, "localhost", 1392 )
}
I also tried the following from irb:
irb(main):001:0> UDPSocket.new.send( "", 0, "localhost", 1392 )
=> 0
......
2007 Oct 18
3
broadcast
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20071018/a54f2b61/attachment.html