0 0slawek Member Licensed User Longtime User Oct 24, 2025 #1 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: Copy Dim check_client As Byte=RunNative("Client_connected",ethServer) C: Copy #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: Oct 24, 2025
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: Copy Dim check_client As Byte=RunNative("Client_connected",ethServer) C: Copy #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.
C candide Active Member Licensed User Longtime User Oct 25, 2025 #2 with a "Serial.println(xxxx) ;" after each line in inline C to test each variable, you will see quickly where is your issue Upvote 0
with a "Serial.println(xxxx) ;" after each line in inline C to test each variable, you will see quickly where is your issue