Class Client is now EthernetClient. Arduino Ethernet shield.

Hi.
I am working with one sketch with Arduino Ethernet shield and I faund one manual for this
https://www.researchgate.net/publication/337877331_Arduino_-_Ethernet_Library_Tutorial
And there on site 10 is a example code

#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
byte server[] = { 64, 233, 187, 99 }; // Google
Client client(server,80);
void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");
if (client.connect()) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
}
void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.connected()) {

But when I start to compile (control) this, my Arduine IDE (1.8.13) says to me , on line 5 where is Client client (server,80); there is a error - Clas Client is now EthernetClient. I was trying to modify this line many different ways but allways will get some kind of error.
I think this example is made a long time ago, with some older Arduino IDE version? And thatsway is coming syntax error?
Can please somebody help me fix this line a correct way.
Thank You.

see the Ethernet library examples in IDE Examples menu. there is a current version of the same example WebClient

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.