I'm using this bit of code to send and receive data, problem is I don't receive anything..
Code:
US_HOST = "239.255.255.250"
US_PORT = 1900
module SSDP
class Client < EventMachine::Connection
def receive_data data
p "Received some data:"
p data
end
end
end
us = EM.open_datagram_socket US_HOST, US_PORT, SSDP::Client
us.send_data msg
def msg
<<-MSEARCH
M-SEARCH * HTTP/1.1\r
HOST: #{US_HOST}:#{US_PORT}\r
MAN: ssdp:discover\r
MX: 1\r
ST: ssdp:all\r
\r
MSEARCH
end
If I'm sending the exact same message with Ruby's UDPSocket
I do receive data (from the UDPSocket
, not from EM)..
Can someone tell me what I'm doing wrong here?
Thanks