Skip to content

Commit

Permalink
Add connect with timeout to Client class
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev committed Apr 15, 2019
1 parent 3d6e4e1 commit 9a9ff62
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cores/esp32/Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class Client: public Stream
public:
virtual int connect(IPAddress ip, uint16_t port) =0;
virtual int connect(const char *host, uint16_t port) =0;
virtual int connect(IPAddress ip, uint16_t port, int timeout) =0;
virtual int connect(const char *host, uint16_t port, int timeout) =0;
virtual size_t write(uint8_t) =0;
virtual size_t write(const uint8_t *buf, size_t size) =0;
virtual int available() = 0;
Expand Down

6 comments on commit 9a9ff62

@JAndrassy
Copy link
Contributor

@JAndrassy JAndrassy commented on 9a9ff62 Apr 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should not add new pure virtual function to Arduino API base classes. other networking libraries don't implement them. now Ethernet, UIPEthernet and other Arduino networking libraries can't be used with this core. esp8266 did it in 2.5.0 and now they fix it for 2.5.1 and now esp32 core developers do the same mistake?

@beegee-tokyo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same problem with TinyGSM after this commit. Doesn't compile anymore.

@me-no-dev
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so with or without this change some things do not work. Let's find a common ground and make it work for all. Any proposals?

@JAndrassy
Copy link
Contributor

@JAndrassy JAndrassy commented on 9a9ff62 Apr 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see how the esp8266 core handled it

or like Erhernet library has it would be even better https://www.arduino.cc/en/Reference/EthernetClientSetConnectionTimeout

@JAndrassy
Copy link
Contributor

@JAndrassy JAndrassy commented on 9a9ff62 May 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you still didn't fix this? why do you need to have the connect version with timeout in the base class?

@Ibrahimsyah
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any update or workaround for this guys? it breaks MqttClient implementation (and other libs that depends on wifiClient i guess)
MqttClient mqttClient(wifiClient);
Currently we can use the older version (v3.0.7) to make it work, but i think this is not a good long term solution as we will miss all latest updates

Please sign in to comment.