Skip to content

WiFiClientSecure / WiFiClient inconsistency in get/set timeout #7355

Closed
@cziter15

Description

@cziter15

No details about the device required as whole ecosystem is affected.

Affected component: WiFiClientSecure, WiFiClient

Description

Shortly, there's inconsistent behavior:

  • setTimeout uses seconds as parameter while
  • getTimeout returns number of miliiseconds

I've encountered that when building framework for my devices. I've been passing timeout from WiFiClient to another component using getTimeout method. Since there is no unit specified I've expected that get will return same unit as set method uses.

Sketch

WiFiClientSecure s;
s.setTimeout(10); // <= this overrides virtual method and sets _timeout to passed value multiplied by 1000
int gv = s.getTimeout();  // <= comes from Stream due to derived chain of classes and returns _timeout

Serial.println(gv); //will print 10000

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions