function ipdHandler(line) {
  var colon = line.indexOf(":");
  if (colon<0) return line; // not enough data here at the moment
  var parms = line.substring(5,colon).split(",");
  lastSocket = parms[0];
  parms[1] = 0|parms[1];
  var len = line.length-(colon+1);
  if (len>=parms[1]) {
   // we have everything
   sockData[parms[0]] += line.substr(colon+1,parms[1]);
   return line.substr(colon+parms[1]+1); // return anything else
  } else { 
   // still some to get
   sockData[parms[0]] += line.substr(colon+1,len);
   return "+IPD,"+parms[0]+","+(parms[1]-len)+":"; // return IPD so we get called next time    
  }
}
//Handle +IPD input data from ESP8266
Handle +IPD input data from ESP8266
Handle + IPD input data from ESP8266
function ipdHandler(line) {
  var colon = line.indexOf(":");
  if (colon<0) return line; 
  var parms = line.substring(5,colon).split(",");
  lastSocket = parms[0];
  parms[1] = 0|parms[1];
  var len = line.length-(colon+1);
  if (len>=parms[1]) {
   sockData[parms[0]] += line.substr(colon+1,parms[1]);
   return line.substr(colon+parms[1]+1); 
  } else { 
   sockData[parms[0]] += line.substr(colon+1,len);
   return "+IPD,"+parms[0]+","+(parms[1]-len)+":"; 
  }
}
function ipdHandler ( line ) { var colon = line . indexOf ( ":" ) ; if ( colon < 0 ) return line ; var parms = line . substring ( 5 , colon ) . split ( "," ) ; lastSocket = parms [ 0 ] ; parms [ 1 ] = 0 | parms [ 1 ] ; var len = line . length - ( colon + 1 ) ; if ( len >= parms [ 1 ] ) { sockData [ parms [ 0 ] ] += line . substr ( colon + 1 , parms [ 1 ] ) ; return line . substr ( colon + parms [ 1 ] + 1 ) ; } else { sockData [ parms [ 0 ] ] += line . substr ( colon + 1 , len ) ; return "+IPD," + parms [ 0 ] + "," + ( parms [ 1 ] - len ) + ":" ; } }
Handle +IPD input data from ESP8266
Handle + IPD input data from ESP8266
// not enough data here at the moment // we have everything // return anything else // still some to get // return IPD so we get called next time    