我是nodejs的新手。我有一个nodejs服务器侦听端口8082和8084.只有一个客户端连接到第一个端口。我想将发送到第一个端口的二进制流发送到连接到第二个端口的浏览器。是以正确的方式传递缓冲区吗?我这样做了吗?
var b = new Buffer(2048);
var liveServer = require('http').createServer( function(req, res) {
console.log( 'Stream Connected: ' + req.socket.remoteAddress );
res.writeHead(200, {
"Connection": "keep-alive"
, "Content-Type": "video/mp4"
, "Accept-Ranges": "bytes" });
res.write(b);
}).listen(8084);
// HTTP Server to accept incomming MP4 Stream
var streamServer = require('http').createServer( function(request, response) {
request.on('data', function(data){
b.copy(data);
});
}).listen(8082);