How to handle simultaneous FTP uploads with node-ftp

355 Views Asked by At

my nodejs web app needs to send an xml via ftp, when i press the submit button the application works perfectly, but when me and my colleague tried to press simoultaneously the button the application return an error:

Error: Unable to parse PASV server response
at Object.reentry [as cb] (C:\Users\astrina\Documents\progetti\kantarnuovo\node_modules\ftp\lib\connection.js:857:19)
at Parser.<anonymous> (C:\Users\astrina\Documents\progetti\kantarnuovo\node_modules\ftp\lib\connection.js:117:20)
at emitTwo (events.js:126:13)
at Parser.emit (events.js:214:7)
at Parser._write (C:\Users\astrina\Documents\progetti\kantarnuovo\node_modules\ftp\lib\parser.js:59:10)
at doWrite (_stream_writable.js:397:12)
at writeOrBuffer (_stream_writable.js:383:5)
at Parser.Writable.write (_stream_writable.js:290:11)
at Socket.ondata (C:\Users\astrina\Documents\progetti\kantarnuovo\node_modules\ftp\lib\connection.js:273:20)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:607:20)

this is the xml sending:

c.put("example/Broadcast_"+blockid+".xml", "/EC/Broadcast/Broadcast_"+blockid+".xml", (err)=>{
             if (err) alert(err)
           });
           c.end()

and this is the ftp declaration:

var c = new Client();
  c.connect({ 
  host: "ftpnew.kantarmedia.fr",
  port: 21, // defaults to 21
  user: "km_italie", // defaults to "anonymous"
  password: "km14IT05", // defaults to "@anonymous"
  keepalive: 10000
  })
0

There are 0 best solutions below