SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ch 3 error: listen EADDRINUSE

    When I try to run the code in the beginning of the chapter 3 section "Building an API" I get the error:
    Error: listen EADDRINUSE

    It seems like that error comes from trying to listen on a port that is already in use.

    If I go into nockmarket.js and change the port to listen on to some other port, it runs fine, but only once.

    chapter03/nockmarket.js (excerpt)

    Code:
        
    db.open(function() {
        submitRandomOrder();
        app.listen(3001); // for example, change port 3000 to 3001
    });
    The,n if I kill the process and run it again, I get the error message back, unless I go back and change it to some other port number again.

    I'm pretty new to some of the nitty gritty details of how the internet works, but if I run netstat it looks like I get the message CLOSE_WAIT on port 3000. It seems like something still wants to listen on that port. It seems like I must have missed something, but going back and looking around, I can't see what.

  2. #2
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Whoops figured it out. Used ctrl z instead of ctrl c to stop the program, so it was still running in the background. So when I tried to start it again of course the computer was like "wait something is already using this port". Sorry pretty new to linux!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •