How to use serialEvent ?

PaulS:
Why not? You should be able to read serial data far faster than it arrives.

One would think so, but it's not working that way. I am trying to fix the sketch for the "Arduino ISP" programmer so it works with IDE 1.0 (runs fine with 22 or 23). AVRdude is trying to send a 133 byte string, and it's getting truncated. The code is pretty simple:

String sBuffer = "";
void setup() {
  Serial.begin(19200); 
  sBuffer.reserve(256);
}

void loop(void) {
  // light the heartbeat LED
  heartbeat();
  // have we received a complete request?  (ends with CRC_EOP)
  if (EOP_SEEN) avrisp();
}

void serialEvent() {
  while (Serial.available())
  {
    char ch = (char)Serial.read();
    sBuffer += ch;  // add it to the buffer
    if (ch == CRC_EOP) EOP_SEEN = true;
  }
}

"avrisp" is the sub that handles all the requests. All of the short ones work fine. When AVRDude tries to write a page, the string is 133 chars - 4 bytes of descriptor, 128 of data, the EOP. The EOP character is never received.

William