I pondered over what you meant by passing a reference to the client in the function, adding EthernetClient client = server.available(); to the start works fine. Is that what you meant?
Many thanks!
I pondered over what you meant by passing a reference to the client in the function, adding EthernetClient client = server.available(); to the start works fine. Is that what you meant?
Many thanks!
I pondered over what you meant by passing a reference to the client in the function, adding EthernetClient client = server.available(); to the start works fine. Is that what you meant?
To the start of what?
If you added client as a global variable, that won't work. Each time a client connects, a new client instance is created. You can pass that client instance to a function, using a reference (&).
void loop()
{
EthernetClient client = server.available();
myFun(client);
}
voif myFun(EthernetClient &joe)
{
if(joe.connected())
{
// Find out what joe wants
}
}