Created
August 30, 2016 07:50
-
-
Save coot/b633f461fba5e8f7bdedfd42ffc5ceb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dgram = require("dgram"); | |
const ssdpRequest = `M-SEARCH * HTTP/1.1 | |
HOST: 239.255.255.250:1900 | |
MAN: "ssdp:discover" | |
MX: 0 | |
ST: urn:schemas-sony-com:service:ScalarWebAPI:1 | |
USER-AGENT: nodejs | |
`; | |
function ssdpConnect() { | |
const sock = dgram.createSocket('udp4'); | |
sock.on('message', (msg, rinfo) => { | |
console.log(`server received: ${msg} from ${rinfo.address}:${rinfo.port}`); | |
}); | |
sock.on('error', console.log.bind(null, 'error')); | |
sock.on('listening', () => console.log(`listening: ${sock.address()}`)); | |
sock.send(Buffer.from(ssdpRequest), 1900, "239.255.255.250", (err) => {if (err) {sock.close(); console.log(err);}}); | |
return sock; | |
} | |
module.exports = ssdpConnect; | |
module.exports.ssdpRequest = ssdpRequest; |
I have tried the Android API example but it cannot find the device. I have an A6000 and I have not idea what to set on the camera to make it discovered. Could you please help?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
struggling with this api currently. this looks correct, but I never seem to get a response. also building for iOS unsuccessfully. Their demo apps work so it does respond somehow...