Network tools or Network Broadcaster etc.

MikeP's picture

Hello people,

I have a simple composition with a multiplexer that changes it's value to black or white (or zero or one) depending on a condition. So for source 0 B=0 W=1 and for source 2 B=1 and W=0.

I've attached the output of the multiplexer to Network Broadcaster and the Broadcast string works correctly. Now I want the exact string to be written on a webpage or a URL, where do I go from here? Do not have the network tools but can buy it if you think it would do the trick. Would it do exactly the same as Network Broadcaster except it can send it to a server? I don't know much about networking at all.

As always thank you very much guys in advance, M

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

dust's picture
Re: Network tools or Network Broadcaster etc.

well i have never been much of a back end type of guy in regards to networking webpages although my aunt is oracles lobbyist so i have been meaning to give oracle a try. so i am sure there may be a better ways of doing this type of thing.. like using jQuery, json or php etc...

the idea is you need to create a server side response and query that. i think most people use php to echo a response then use js/html to insert that response variable into your div element.

i made a simple example of how to use network tools to communicate with your composition, do some server side logic and return that result back to the webpage. its a simple password validation script that requires kineme file tools as well as network tools.

for safety purposes i wouldn't rely on this script to be used as a log in given all the interesting things you can do with javascript debuggers like redirect the validation function to a different server or something.

so some sort of data encryption or token would need to be used. however this is fairly safe as your not returning a header people can see in the address bar or broadcasting.

for some reason garbage collection is making it so i can not open the dashcode file this example was made with so I'm including source files. you can however open the quartz file then surf to my computer and try it.

http://dmbp.redirectme.net/~d0cut0uch/dtool/index.html

if you don't have an os x server then you can turn on your personal website in sharing preferences. you would want edit the file writer in qc and http requests like this.

httpGet = "http://computerName.local/~userName/gate.txt" fileTools = "~/Sites/gate.tx"

here are the important js functions.

function sendToQC(queryPath,queryParameters)
{
    var qp = new Array();
    for(var p in queryParameters)
    qp.push(encodeURIComponent(p) + '=' + encodeURIComponent(queryParameters[p]));
    req = new XMLHttpRequest();
    req.open('POST', 'http://localhost:8080/' + encodeURIComponent(queryPath) + '?' + qp.join('&'),true);
    req.send();
}
 
function httpGet(theUrl, check)
{   
 
    var http = false;
    if(navigator.appName == "Microsoft Internet Explorer") 
    { http = new ActiveXObject("Microsoft.XMLHTTP");
    } else { http = new XMLHttpRequest();}
 
    http.open("GET", theUrl);
    http.onreadystatechange=function() {
    if(check == true && http.readyState == 4) {
    if(http.responseText == true){
    alert("password accepted");} else {
    alert("password denied");}}}
    http.send(null);
}
 
 
function updatePass(event)
{
    var textFieldValue = document.getElementById("password");
    textFieldValue = textFieldValue.value;
    sendToQC("checkPass",{pass:textFieldValue});
    httpGet("http://dmbp.redirectme.net/~d0cut0uch/gate.txt", false);
 
}
 
function check(event)
{
    if(event)
    {httpGet("http://dmbp.redirectme.net/~d0cut0uch/gate.txt", true);}
    else{httpGet("hhttp://dmbp.redirectme.net/~d0cut0uch//gate.txt", false);}
}
 
 
function load()
{
    dashcode.setupParts();
    sendToQC("checkPass",{pass:"no"});
}

just put the whole zip file in your ~/Sites folder than you should be able to access things by just replacing my URL's to yours.

hope this helps. if anybody knows a better way of doing this or has cool hack that will let you post from the http query patch and grab the header in js that would defiantly be interesting. i have not tried that yet.

PreviewAttachmentSize
dtool.zip57.93 KB

MikeP's picture
Re: Network tools or Network Broadcaster etc.

Hey Dust,

Much obliged dude. Been going through your reply since yesterday, have a few questions that I'm compiling. OK to ask once I'm done?

thanks again, M

dust's picture
Re: Network tools or Network Broadcaster etc.

feel free to ask or post here...

skype:ter.maximus?call

MikeP's picture
.........

.........