Go Down

Topic: EthernetServer connected() (Read 1 time) previous topic - next topic


EthernetServer::available() only returns a valid EthernetClient if the connection is established AND there is data available to read. I need a possibility to get the connected client also when there's nothing to read. (I want to listen on a tcp port and then transmit sensor data while the connection is established.)

I recommend a connected function in the EthernetServer class:

Code: [Select]

EthernetClient EthernetServer::connected()

    for (int sock = 0; sock < MAX_SOCK_NUM; sock++) {
        EthernetClient client(sock);
        if (EthernetClass::_server_port[sock] == _port &&
            (client.status() == SnSR::ESTABLISHED ||
             (client.status() == SnSR::CLOSE_WAIT && client.available()))) {
            return client;

    return EthernetClient(MAX_SOCK_NUM);

regards: Tom

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131