B4R Question rEthernet - W5500 - how to check if the client has connected to the server?

0slawek

Member
Licensed User
Longtime User
Hello
I have a device that connects to a server but doesn't send anything until it's asked. I can't change this. I'm building a server on an ESP32 + W5500. How do I check if the client has connected to send a request? I know I need to build this function in C, but I don't know how. Could someone help me?
B4X:
                Dim check_client As Byte=RunNative("Client_connected",ethServer)

C:
#if c
B4R::Object* Client_connected(B4R::Object* ess) {
   
    EthernetServer* server = ess;
    EthernetClient c = server.accept();
    bool temp;
    if (c) {
        temp=true;
      }
    else
    {
        temp=false;
    }
    Byte a = temp;
    return returnvalue.wrapNumber(a);
}
#End If

But there is an error here and I can't solve it.
 
Last edited:
Top