2013-05-23 4 views
11

Próbuję uruchomić po zastosowaniu js węzła jak wspomniano https://github.com/joyent/node/issues/2194Węzeł js 0.10.7: obsługa klastra dla udgr dgram?

var util = require("util"), 
    dgram = require("dgram"), 
    cluster = require('cluster'); 

var udp = dgram.createSocket("udp4"); 
var port = 1190; 

if (cluster.isMaster) { 
    for (i = 0; i < 2; i++) { 
    cluster.fork(); 
    } 
} else { 
    util.log("starting udp server on port " + port); 
    udp.on("error", function (error) { 
    util.log("failed to bind to UDP port - " + error) 
    }); 
    udp.bind(port); 
} 

Aplikacja wychodzi natychmiast następujący wynik:

23 May 23:22:13 - starting udp server on port 1190 
23 May 23:22:13 - starting udp server on port 1190 

events.js:72 
     throw er; // Unhandled 'error' event 
      ^
Error: write ENOTSUP - cannot write to IPC channel. 
    at errnoException (child_process.js:980:11) 
    at ChildProcess.target.send (child_process.js:455:16) 
    at Worker.send (cluster.js:401:21) 
    at sendInternalMessage (cluster.js:394:10) 
    at handleResponse (cluster.js:177:5) 
    at respond (cluster.js:192:5) 
    at Object.messageHandler.queryServer (cluster.js:242:5) 
    at handleMessage (cluster.js:197:32) 
    at ChildProcess.EventEmitter.emit (events.js:117:20) 
    at handleMessage (child_process.js:318:10) 

Czy ktoś wie co się dzieje? Podczas uruchamiania bez klastrów wszystko jest w porządku. Wygląda na to, że klaster nie obsługuje udp?

Niektóre specyfikacje:

Window 7 x64 
node js 0.10.7 
+0

i uruchomiłem dokładnie ten sam problem (próbowałem zrobić 'socket.send (...)' na złączu udp), działa dobrze bez środowiska klastrowego. czy masz coś nowego w tej kwestii? – zaphod1984

+0

wydaje się, że działa poprawnie na Linuksie, ale nie w oknach. – zaphod1984

+0

https://gist.github.com/zaphod1984/5668274 – zaphod1984

Odpowiedz

1

mówi w swój link pod warunkiem, że wsparcie dla klastrów UDP dodano v0.11.14. Najprawdopodobniej wystarczy zaktualizować swoją wersję pliku node.js