Function Stuck in send_DHCP_DISCOVER()

I am Working on DHCP client application . Where when send_DHCP_DISCOVER() is called and then it never returns last statement is sendto() function call. Can some one Help?
Working on Controller and W5500 Interface

I get stuck at following code snippet in socket.c in function sendto() from github library for w5500 in an application of DHCP client. Can somebody tell how to solve this?

if (len > freesize) len = freesize; // check size not to exceed MAX size.
while(1)
{
freesize = getSn_TX_FSR(sn);
if(getSn_SR(sn) == SOCK_CLOSED) return SOCKERR_SOCKCLOSED;
if( (sock_io_mode & (1<<sn)) && (len > freesize) ) return SOCK_BUSY;
if(len <= freesize) break;
};

The code block maybe blocked when the transmit data size is less then socket free tx buffer size.

So, You first check the socket tx memory allocation size.

Thank you.

1 Like

Yes i fixed that now its working… Thanks