title: Nodejs & socket io : warn - error raised: Error: listen EADDRINUSE
body: <p>I am giving a try to Node.js with socket.io </p>
  
  <p>Now here is my scenario i am ubuntu 12.04 user and i have folder pp on desktop </p>
  
  <p>inside that i am putted server file i.e  <code>app.js</code></p>
  
  <p>Here is the content </p>
  
  <pre><code>var fs = require('fs')
      , http = require('http')
      , socketio = require('socket.io');
  
  var server = http.createServer(function(req, res) {
      res.writeHead(200, { 'Content-type': 'text/html'});
      res.end(fs.readFileSync(__dirname + '/index.html'));
  }).listen(8080, function() {
      console.log('Listening at: http://localhost:8080');
  });
  
  socketio.listen(server).on('connection', function (socket) {
      socket.on('message', function (msg) {
          console.log('Message Received: ', msg);
          socket.broadcast.emit('message', msg);
      });
  });
  </code></pre>
  
  <p>Now in the same folder i have another file index.html   like </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          $(function(){
              var iosocket = io.connect();
  
              iosocket.on('connect', function () {
                  $('#incomingChatMessages').append($('&lt;li&gt;Connected&lt;/li&gt;'));
  
                  iosocket.on('message', function(message) {
                      $('#incomingChatMessages').append($('&lt;li&gt;&lt;/li&gt;').text(message));
                  });
                  iosocket.on('disconnect', function() {
                      $('#incomingChatMessages').append('&lt;li&gt;Disconnected&lt;/li&gt;');
                  });
              });
  
              $('#outgoingChatMessage').keypress(function(event) {
                  if(event.which == 13) {
                      event.preventDefault();
                      iosocket.send($('#outgoingChatMessage').val());
                      $('#incomingChatMessages').append($('&lt;li&gt;&lt;/li&gt;').text($('#outgoingChatMessage').val()));
                      $('#outgoingChatMessage').val('');
                  }
              });
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  Incoming Chat: &lt;ul id="incomingChatMessages"&gt;&lt;/ul&gt;
  
  
  &lt;input type="text" id="outgoingChatMessage"&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>when i am trying to run the app.js useing node like </p>
  
  <pre><code> node app.js 
  </code></pre>
  
  <p>I am getting the error </p>
  
  <pre><code> warn  - error raised: Error: listen EADDRINUSE
  </code></pre>
  
  <p>I go through some doc and found that port are busy so restarted the system but still i am getting the same error .</p>
  
  <p>Please tell me what might i am doing wrong .</p>