title: Sending udp packets using chrome.socket.udp
body: <p>I was creating a chrome extension in which i am using <a href="https://developer.chrome.com/apps/sockets_udp#method-send" rel="nofollow">chrome.socket.udp</a>. I am following  <a href="https://developer.chrome.com/apps/app_network#connecting" rel="nofollow">this tutorial</a> but i don't see any data sent.</p>
  
  <p>This is my code..</p>
  
  <pre><code>//var socketId;
  
  var address = "127.0.0.1"; 
  var port = 6454;
  
  function str2ab(str) {
    var buf = new ArrayBuffer(str.length*2); 
    var bufView = new Uint16Array(buf);
    for (var i=0, strLen=str.length; i&lt;strLen; i++) {
    bufView[i] = str.charCodeAt(i);
   }
  return bufView;
  }
  
  function sendPackets(){
  console.log("sending packets");
  chrome.sockets.udp.create({}, function(socketInfo) {
   // The socket is created, now we can send some data
  var socketId = socketInfo.socketId;
  console.log(socketId);
   chrome.sockets.udp.send(socketId, str2ab("hello"),
      '127.0.0.1', 1337, function(sendInfo) {
        console.log("packets sent");  
        console.log("sent " + sendInfo.bytesSent);
    });
  });
  }
  
  document.getElementById('send').addEventListener('click', sendPackets);
  </code></pre>
  
  <p>this is the output i am getting in console...</p>
  
  <pre><code>sending packets background.js:16
  165 background.js:20
  </code></pre>
  
  <p>And there is no sign of sent data ....plz help...</p>