|
From: | Yafei Yan |
Subject: | Re: [lwip-users] Problem with tcp_bind() |
Date: | Thu, 31 Oct 2013 10:06:17 +0800 |
My application works fine but…
I have LWIP running on my ARM platform and it talks to my PC application just fine.
I’m send the PC an unsolicited message every second.
If my PC connection gets lost…i.e. I pull the network cable out of the PC
I get the expected error next time I call tcp_write().
I call tcp_close() and drop back to my loop listening for a connection which is (simplified)
err_t tcp_listen_init(void)
{
err_t error;
struct tcp_pcb* ptel_pcb;
ptel_pcb = tcp_new();
if (ptel_pcb != NULL)
{
error = tcp_bind(ptel_pcb, IP_ADDR_ANY, PORT1);
}
if (error == ERR_OK)
{
ptel_pcb = tcp_listen(ptel_pcb);
tcp_arg(ptel_pcb, ptel_pcb);
tcp_accept(ptel_pcb, accept);
printf("[Ttcp_listen_init started: PORT = %05d]\n", PORT1);
}
}
else
{
//**********************
printf("[TUnable to Bind for tcp_listen_init]\n”);
tcp_close(ptel_pcb);
}
}
else
{
error = ERR_MEM;
printf("[TNo memory for tcp_listen_init]\n");
}
return error;
}
I get stuck in a loop allways hitting the statements below //**********************
tcp_bind() is reporting ERR_USE from the ‘address already is in use’ term
Any idea how to close/abort/abandon the link if the cable is pulled out of the PC without getting into this loop I am in?
Regards
Hugh
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users
[Prev in Thread] | Current Thread | [Next in Thread] |