Skip to content

How to end the connection? #5

@dkrebs

Description

@dkrebs

I'm trying to send a file via the client.put function to a server which I created with the tftp.createServer function. The server is set to allow put requests and saves the file in a directory. So far, everything is working, the file is present at the server and the size seems to be fine.

However, after sending the file, the client always get's a timeout [Error: Timed out] and I can't find any event which allows me to end the helper connection / see if the transfer was successful.

Any ideas? Thank you in advance! :)

Client:

        var client = tftp.createClient ({ port: PORT });
        client.put(local,function(error) {
            console.log('cb');
            if (error) console.error (error);
        });

Server:

        var server = tftp.createServer({
            host: HOST,
            port: PORT,
            root: rootDir,
            denyGET: true
        });

        server.on ("request", function (req, res){
            console.log(req.file);

            req.on ("error", function (error){
                console.error ("[" + req.stats.remoteAddress + ":" + req.stats.remotePort +
                    "] (" + req.file + ") " + error.message);
            });
            req.on('end',function(){
                console.log('req.close()');
                req.close();
            });
        });
        server.on('close',function(){
            console.log('closed'); 
        });
        server.on ("listening", function(){
            console.log('listening');
        });
        server.listen();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions