what does client.connect() do?

Hi,

Read the (sparse) reference documentation and while client.connect(ip, port) and client.connect(URL, port) are pretty obvious, what exactly does client.connect(), i.e. without passing anything into it, do?

Many thanks,
Jesse

Depends on what class the object client is of. For the class EthernetClient a method connect() without parameters is not defined.

Ah I get it now, I was mixing two sources, one was still using

Client client(server, 80);

whereas the other part was using

EthernetClient client;

The client.connect() bit was coming from the first bit.
Still wonder though why it's mentioned in the reference documentation (Ethernet - Arduino Reference) then, along with a code example using EthernetClient. Where would client.connect() be useful?

Thanks again,
Jesse

The client.connect() bit was coming from the first bit.

No, it doesn't. At least if that class is the one of the Arduino IDE. EthernetClient inherits from Client so it uses all methods from it (BTW almost all are purely virtual). The reference is wrong in this point as the connect() method without parameters does not exist, at least not in current versions of the IDE (1.0.5 as well as the beta 1.5.5).

Where would client.connect() be useful?

I don't see an application where this would be useful, except if the needed parameter could be set in the class before connecting but that would require bigger changes in the interface and in the current implementations.