Replace the following code
while(len <= 0)
{
len = recv(g_socket, data_buff, rx_buff_size, 0);
}
if(get_pending_signal(current))
{
break;
}
while(len <= 0)
{
len = recv(g_socket, data_buff, rx_buff_size, 0);
/* check signal here*/
if(get_pending_signal(current))
{
signal_flag = 1; /*add a flag for signal, to keep ur logic */
break;
}
}
if(signal_flag)
{
break;
}
Hope it will work
Rgds,
Adil