Skip to content

WiFiClientSecure connection to IP address(Connection Fails) #2604

@telliottosceola

Description

@telliottosceola

What you are trying to do?
Use WiFiClientSecure to connect to an IP address using CACert.

Describe your system( Hardware, computer, O/S, core version, environment).
ESP32 ESP-WROOM-32 Arduino Platformio using Adafruit_Feather32

Describe what is failing.
WiFiClientSecure(IPaddress,Port) fails to connect to the remote server.

Show the shortest possible code that will duplicate the error.
I was able to simply replicate this issue by modifying the WiFiClientSecure.ino example. I obtained the IP address for www.howsmyssl.com and used that IP in the WiFiClientSecure.connect function. Full code available here:
https://github.com/telliottosceola/WiFi_Client_Secure_IP_Error

Show the EXACT error message(it doesn't work is not enough).
Debug level set to 5 outputs the following when executing the code:

Attempting to connect to SSID: Travis-WiFi
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START

.[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:385] _eventCallback(): STA IP: 192.168.1.21, MASK: 255.255.255.0, GW: 192.168.1.1
Connected to Travis-WiFi

Starting connection to server...
[V][ssl_client.cpp:53] start_ssl_client(): Free internal heap before TLS 288964
[V][ssl_client.cpp:55] start_ssl_client(): Starting socket
[E][ssl_client.cpp:82] start_ssl_client(): Connect to Server failed!
[E][WiFiClientSecure.cpp:118] connect(): start_ssl_client: -1
[V][ssl_client.cpp:243] stop_ssl_socket(): Cleaning SSL connection.
Connection failed!

Thank you very much for taking the time to review this. I ran into this issue while trying to use the PubSub client to make a secure connection to a local(LAN) server. I tracked it down to this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions