We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
Simple Service Discovery Protocol
Send advertise/Notify using UDP with port=1900 is failing using BSD socket.
I am sending broadcast message.
Am I missing something.
const u8* notify_data = "NOTIFY * HTTP/1.0\r\n" "Host: 239.255.255.250:1900\r\n" "Cache-Control: max-age=900\r\n" "Location: ">probuf1/index.html\r\n" "NT: upnp:rootdevice\r\n" "USN: uuid:test::upnp:rootdevice\r\n" "NTS: ssdp:alive\r\n" "Server: NBF4/1.0 UPnP/1.0 test\r\n\r\n";
int sock_; SOCKADDR_IN addr_;
sock_ = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); if(sock_ == -1) { return; }
addr_.sin_family = PF_INET; addr_.sin_port = htons(port_num); addr_.sin_addr.s_addr = INADDR_NONE; int ret = connect (sock_, (SOCKADDR*)& addr_, sizeof(addr_));
int size = sizeof(notify_data)/sizeof(notify_data[0]);
int bytes_sent = sendto (sock_, (char *)notify_data, size, 0, (SOCKADDR*)& addr_, sizeof(addr_));
if (bytes_sent < 0) { return; // Failed here }