nodejs tcp socket sends multiple data event

25 views
Skip to first unread message

manish chandra

unread,
Aug 10, 2017, 2:19:50 PM8/10/17
to nodejs
Hi All , I am working to create a HTTP server using net module of NODE JS. I am facing an issue when content type is multipart/form-data
With content type as multipart/form-data and uploading mulitple files , request is coming in chunks . Basically data event on socket is gettting fired twice. First time when data event is getting fired , it contains request with just header contents and in second attempt it has only body content
Basically issue is similar to this stack overflow https://stackoverflow.com/questions/40591455/nodejs-tcp-socket-sends-multiple-data-event . I am using mac OSX
function in which data event is handled ——> lib -> server.js -> dataEventHandler
testing of server code - test->index.js
Currently I’m setting a timeout for 1second before proceeding further to process request. In that 1second , appending all the variuos requests received from data events into an array . But its kind of blocking approach . Can someone help me in the correct approach on this ?
Reply all
Reply to author
Forward
0 new messages