Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Decompression not working #9

Open
hynese opened this Issue · 0 comments

1 participant

@hynese

When I try to decompress, I get the following error:

stream.js:46
  dest.on('drain', ondrain);
       ^
TypeError: Object  has no method 'on'
    at Socket.pipe (stream.js:46:8)
    at Server.<anonymous> (/home/hynese/backopt/server5.js:36:6)
    at Server.emit (events.js:64:17)
    at IOWatcher.callback (net.js:950:12)

Here is my code:

var net=require('net');
var sys=require('sys');
var compress=require('./node-compress/compress');

var gzip=new compress.Gzip;
var gunzip=new compress.Gunzip;
//gzip.init();
//gunzip.init();

var sourceport = 6999;
var destport = 7000;

net.createServer(function(s)
{
    var buff = "";
    var connected = false;
    var cli = net.createConnection(destport,'172.16.1.224');
    s.on('data', function(d) {
        if (connected)
        {
                sys.log("1");
                gunzip.init();
                cli.write(gunzip.inflate(d,"binary")+gunzip.end());
                //cli.write(d);
        } else {
           buff += d.toString();
        }
        //sys.log(d);
    });
    cli.on('connect', function() {
        connected = true;
        cli.write(buff);
    });
        sys.log("2");
        gzip.init();
        cli.pipe(gzip.deflate(s,"binary")+gzip.end());
        //cli.pipe(s);
}).listen(sourceport);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.