Skip to content

Commit

Permalink
fix discover udp logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mharsch committed Mar 7, 2013
1 parent 3c8904f commit 362f64a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ module.exports = function (search_id, cb) {
parseInt(search_id, 16)});
disc_pkt = proto.encode_msg(disc_msg);

sock.send(disc_pkt, 0, disc_pkt.length, 65001, '255.255.255.255',
function (err, bytes) {
if (err) throw new Error('problem sending discover req dgram');
sock.on('listening', function () {
sock.setBroadcast(true);
sock.send(disc_pkt, 0, disc_pkt.length, 65001, '255.255.255.255',
function (err, bytes) {
if (err) throw new Error('problem sending discover req');
});
});
sock.bind();
}

0 comments on commit 362f64a

Please sign in to comment.