In my project I'm using my custom PCB with ESP32 pico-D4 and ENJ28J60 ethernet IC. I'm trying to make https post request to my Windows Server periodically. I'm coding on platformIO using Arduino framework.
When I do https request on my own server with the same configuration and same code there is no problem. I send a request every 2 seconds without failure. But when I try to do the same thing with my customer's server there are only 4 succesful requests. After that I get connection failure. If I change UIP_CONF_MAX_CONNECTIONS setting (default 4 connections) in uipethernet-conf.h to another value, I can make that much succesful connections.
- I have tried to use other ssl libraries with no success.
- I have tried diffrent http keep-alive values with no success
- I have tried using wifi and same result
- I have tried to use http_client.setInsecure() and with using certificate but nothing changed.
I think the problem is Windows server is not closing connection properly and I can't do more requests after number of UIP_CONF_MAX_CONNECTIONS. But I am not able to configure anything on my customers windows server.
And I tried the same request with Postman on my windows pc, and there is no problem. Every request is returned with the value I expect. There are no connection errors.
Libraries I use:jandrassy/EthernetENC@^2.0.5digitaldragon/SSLClient@^1.3.2arduino-libraries/ArduinoHttpClient@^0.6.1
My code:
if (millis() - lastnnn >= 2000) { Serial.println("Making post request..."); String body = "{"userName": "" + qr_user +"","password": "" + qr_password +"","idendityId": "" +"11223344" +"","cihazId": "" + EUI +""}"; http_client.sendHeader("Cache-Control","no-cache"); http_client.sendHeader("Connection","close"); http_client.post("/api/MobilApi/BarkodeReader","application/json",body); int status_code = http_client.responseStatusCode(); String response = http_client.responseBody(); Serial.print("Status code: "); Serial.println(status_code); Serial.print("Response: "); Serial.println(response); http_client.stop(); Ethernet.maintain(); lastnnn = millis();}Output:
Making post request... Status code: 200 Response: false Making post request... Status code: 200 Response: false Making post request... Status code: 200 Response: false Making post request... Status code: 200 Response: false [ 21685][E][ssl__client.cpp:400] init_tcp_connection(): Connection to server failed, is the signal good, server available at this address and timeout sufficient? kresapi.teias.gov.tr:443 [ 21702][E][ssl__client.cpp:45] _handle_error(): [start_ssl_client():370]: (-2) BIGNUM - An error occurred while reading from or writing to a file [ 21715][E][SSLClient.cpp:242] connect(): start_ssl_client failed: 0