FreeRTOS HTTPS Request Closing Socket

Hello,

I am running into a strange issue when sending an HTTPS request. I am able to send the request fine and get a response, but as soon as I receive the response the socket closes. I am wondering if there is any way if I can tell if this is happening on my end or the server end? My gut says this is happening on my end.

Here is a example of my logs:

FreeRTOS_connect: 20692 to 12345678ip:443
Socket 20692 -> 12345678ip:443 State eCLOSED->eCONNECT_SYN
prvSocketSetMSS: 1400 bytes for 12345678ip:443
Connect[12345678ip:443]: next timeout 1: 3000 ms
MSS change 1400 -> 1440
Socket 20692 -> 12345678ip:443 State eCONNECT_SYN->eESTABLISHED
[INFO ] [2023-12-11T16:25:44.000Z] [TLS_connectToServer:507] TLS connected to upgrade.website.com:443
win_tx_ack: acked 431 expc 431 len 31
Socket 20692 -> 12345678ip:443 State eESTABLISHED->eLAST_ACK
Socket 20692 -> 12345678ip:443 State eLAST_ACK->eCLOSE_WAIT

Is there a way I can tell if my code is closing the socket? Just need some help with where to start looking.

Hi @drowsell,
Could you help to capture pcap file to check if the disconnection is triggered by server side?
Could you help to check if you enable keep a-live in HTTP header?

From this website:

By default, HTTP connections close after each request.

Thank you.

Let us know if setting the keep-alive flag solves your problem.

Hi everyone,

The keep-alive message is being set in the outgoing message. I am going to hook the device up to wireshark today to see if I can spot what is happening.

I tried to sniff out the packet via wireshark, but since this is an embedded device that is separate from my PC I have not been able to see the traffic. I’m not exactly sure how I could intercept this traffic given the situation. Any thoughts on how I could further troubleshoot?

One way is to connect your device to your PC and then share PC’s internet with the device - that way you will be able to run WireShark on the PC.