Usi Usi
Usi Usi

Reputation: 2997

Strange error using socket.io with Node js

I'm trying to send some messages to a server. That's what I do

for(var i=0; i<100; i++){
  var post={
    att1       : var.att[i].att1,
    att2       : var.att[i].att2,
    att3       : var.att[i].att3,
    att4       : var.att[i].att4
  }

  sock.write(JSON.stringify(post));
}

But I get this strange error

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: write EPIPE
    at errnoException (net.js:904:11)
    at Object.afterWrite (net.js:720:19)
logout

Why this happens? Is the buffer of the socket full?

Upvotes: 0

Views: 156

Answers (1)

Alex Pakka
Alex Pakka

Reputation: 9706

It usually means that the other end closed the connection unexpectedly. In any case, you were writing to the closed socket.

Also, 100.length is not a valid JavaScript.

Upvotes: 1

Related Questions