LwIP netconn problem s bind()

Martin Persich persich na transcon.cz
Pátek Květen 2 15:54:01 CEST 2014


Dobrý den,
zkuste:
------------------------
   struct netconn *pxListener;

   pxListener = netconn_new( NETCONN_TCP );  // Create a new tcp connection 
handle

   if(pxListener!=NULL) {

    pxListener->pcb.tcp->so_options|=(SOF_REUSEADDR);
    netconn_bind(pxListener, NULL, TELNET_PORT );
    netconn_listen( pxListener );
    ....
  }
------------------------

Martin. persich na transcon.cz


----- Original Message ----- 
From: "d.petr" <d.petr na post.cz>
To: "HW-news" <hw-list na list.hw.cz>
Sent: Friday, May 02, 2014 3:08 PM
Subject: Re: LwIP netconn problem s bind()


Stano wrote:
> Otvori to TCP port a caka na spojenie, ked sa prenesu data port sa
> zatvori a connection sa maze.
> Problem je v tom ze po zmazani uz 2hy krat netconn_bind() nevrati OK
> Docital som sa na strankach LwIP:
> "Bind a netconn to a local IP address or to any IP address. Note that if
> you try to bind the same address and/or port you might get an error
> (ERR_USE, address in use), even if you delete the netconn. Only after
> some time (minutes) the resources are completely cleared in the
>...
> Vie niekto poradit ako tento problem spravne vyriesit? Napada ma
> nastavit velmi maly timeout ale to mi pride ako velmi spinave riesenie.
>
> S pozdravom
> Stano

Normálně se to dá řešit po vytvoření soketu:
int optval=1;
setsockopt (*Socket, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof optval);

Podívejte se po ekvivalentu.
PM
_______________________________________________
HW-list mailing list  -  sponsored by www.HW.cz
Hw-list na list.hw.cz
http://list.hw.cz/mailman/listinfo/hw-list





Další informace o konferenci Hw-list