lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Problem with tcp_bind()


From: Hugh Reynolds
Subject: [lwip-users] Problem with tcp_bind()
Date: Wed, 30 Oct 2013 17:29:35 -0000

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

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]