Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By nikant
#43967 Well.. if someone could offer some enlightenment.. can't find the error in the following (modified host from the original of course..)

It hangs at client.connect for some time.. and then connection fails.
the same happens in "" or ""

other hosts work and reply normally

Is it my network?

Code: Select all/*
 *  HTTP over TLS (HTTPS) example sketch
 *  This example demonstrates how to use
 *  WiFiClientSecure class to access HTTPS API.
 *  We fetch and display the status of
 *  esp8266/Arduino project continuous integration
 *  build.
 *  Created by Ivan Grokhotkov, 2015.
 *  This example is in public domain.

#include <ESP8266WiFi.h>

// Replace with your network credentials
const char* ssid = ".....";
const char* password = ".........";

const char* host = "";
const int httpsPort = 443;

// Use web browser to view and copy
// SHA1 fingerprint of the certificate
//const char* fingerprint = "CF 05 98 89 CA FF 8E D8 5E 5C E0 C2 E4 F7 E6 C3 C7 50 DD 5C";
const char* fingerprint = "99 70 D6 7C B8 42 71 18 DC A6 88 DB DC C8 69 66 96 9D 51 88"; //google

void setup() {
  Serial.print("connecting to ");
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  // Use WiFiClientSecure class to create TLS connection
  WiFiClientSecure client;
  Serial.print("connecting to ");

  if (!client.connect(host, httpsPort)) {
    Serial.println("connection failed");

  if (client.verify(fingerprint, host)) {
    Serial.println("certificate matches");
  } else {
    Serial.println("certificate doesn't match");

  String url = "/";
  Serial.print("requesting URL: ");

  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" +
               "User-Agent: ESP8266\r\n" +
               "Connection: close\r\n\r\n");

  Serial.println("request sent");
  while (client.connected()) {
    String line = client.readStringUntil('\n');
    if (line == "\r") {
      Serial.println("headers received");
  String line = client.readStringUntil('\n');

  Serial.println("reply was:");
  Serial.println("closing connection");

void loop() {

output is

Code: Select allconnecting to ssid
WiFi connected
IP address:
connecting to
connection failed
User avatar
By nikant
danbicks wrote:This is very interesting, are you trying to receive calendar events for a given day and time?

Please keep us posted on your progress.



Yes.. :)

I'm working on a project (and hopefully I'll post here in a few days) and was thinking of working with Google calendar.
Unfortunately https connections to Google have proven very unreliable and also there seems to be some bugs in the ESP/Arduino code.
I've reported it here

Connections are unreliable because: 1. Google changes its SHA1 certificate depending on the server you hit..
2. resolving goes to a pool of servers (so not one known IP) or even to sometimes.. and returns a "connection refused"