This file contains hidden or 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
| import socket | |
| minissdpdSocket = '/var/run/minissdpd.sock' # The socket for talking to minissdpd | |
| # Sends a message to the given socket | |
| def sendMessage(message): | |
| s = socket.socket(socket.AF_UNIX) | |
| s.settimeout(1) # 1 second timeout, after all it should be instant because its local | |
| s.connect(minissdpdSocket) | |
| s.send(message) |
This file contains hidden or 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
| var dgram = require('dgram'); // dgram is UDP | |
| // Listen for responses | |
| function listen(port) { | |
| var server = dgram.createSocket("udp4"); | |
| server.on("message", function (msg, rinfo) { | |
| console.log("server got: " + msg + " from " + rinfo.address + ":" + rinfo.port); | |
| }); |
NewerOlder