lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Problem with tcp_bind()


From: Noam weissman
Subject: Re: [lwip-users] Problem with tcp_bind()
Date: Thu, 31 Oct 2013 09:33:13 +0200

Hi,

 

I.41 is more or less the same as 1.32 The main difference is the sys_arch.c file.

 

This file has been changed.

 

Try and find someone that already ported this file to your processor.

 

BR,

Noam.

 

 

 

From: address@hidden [mailto:address@hidden On Behalf Of Hugh Reynolds
Sent: ה 31 אוקטובר 2013 07:24
To: 'Mailing list for lwIP users'
Subject: Re: [lwip-users] Problem with tcp_bind()

 

Yafei,

 

Thanks for the input.  I see that in 1.4.1.  Unfortunately I am left maintaining 1.3.1.

Is there a guide for transitioning to 1.4.1?

 

Regards

 

Hugh

 

From: address@hidden [mailto:address@hidden] On Behalf Of Yafei Yan
Sent: 31 October 2013 02:06
To: address@hidden; Mailing list for lwIP users
Subject: Re: [lwip-users] Problem with tcp_bind()

 

Hi,

 

When you call tcp_close(), the socket is not close immediately. The tcp connection will come into TCP_WAIT,  after few minitues the connection will close completely and free the socket.

If you want to call tcp_bind() directly after call tcp_close, you can configure the socket attribute "SO_REUSE" as follow:

/**

 * SO_REUSE==1: Enable SO_REUSEADDR option.

 */

#ifndef SO_REUSE

#define SO_REUSE                        1

#endif

 

 

Yafei

 

2013/10/31 Hugh Reynolds <address@hidden>

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

 





************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************





************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************


reply via email to

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