 #define P1_BUFFER_SIZE_BYTES 64
 
 #define MAX_TELEGRAM_SIZE 4096
+
+#define READ_TIMEOUT_MILLIS 1000
 
 #ifndef SERVER_PORT
 #define SERVER_PORT 443

uint16 readTelegram(byte *buffer, uint16 size) {
  uint16 i;
  byte state = 0;
  for (i = 0; i < size; i++) {
    int b = P1_INPUT.read();
    if (b < 0) {
      Serial.println("Read timed out before telegram end sequence");
      return 0;
    }
    buffer[i] = b;

    // Each telegram ends with a line like this:


  Serial.print("Sent telegram of ");
  Serial.print(size);
  Serial.println(" bytes");

  return true;
}

