Tool/software:
I am having a minimal setup with the Client code running on my TMS570 MCU and server code on another laptop.
I am using LwIP 1.4.1 library, and the client fails to reconnect if the server is disconnected.
err_t
TCASTCPClientInit(uint32_t ip_addr, uint32_t _port)
{
struct ip_addr ipaddr;
void *pcb;
ipaddr.addr = ip_addr;
//IP4_ADDR(&ipaddr, 192, 168, 1, 10);
pcb = tcp_new();
gTCPCpcb = pcb;
tcp_err(pcb, TCPCError);
terrCode = tcp_connect(pcb, &ipaddr, _port, TCPCConnected);
return(terrCode);
}
This is the logic for initialization. I am expecting a non-zero error value if the client is not connected to the server(server script not running).
But the error code always returns 0 even in case of successful connection or no connection.
How can this be sorted?