The tcp_listen call should be change like this:

ptel_pcb = tcp_listen(ptel_pcb);

Because the ptel_pcb is freed, and a "listen pcb" is return, and it's not the 
same one. In last CVS head "rawapi.txt" you can read :

"- struct tcp_pcb *tcp_listen(struct tcp_pcb *pcb)

  Commands a pcb to start listening for incoming connections. When an
  incoming connection is accepted, the function specified with the
  tcp_accept() function will be called. The pcb will have to be bound
  to a local port with the tcp_bind() function.

  The tcp_listen() function returns a new connection identifier, and
  the one passed as an argument to the function will be
  deallocated. The reason for this behavior is that less memory is
  needed for a connection that is listening, so tcp_listen() will
  reclaim the memory needed for the original connection and allocate a
  new smaller memory block for the listening connection.

  tcp_listen() may return NULL if no memory was available for the
  listening connection. If so, the memory associated with the pcb
  passed as an argument to tcp_listen() will not be deallocated."
  
====================================
Frédéric BERNON 
HYMATOM SA 
Chef de projet informatique 
Microsoft Certified Professional 
Tél. : +33 (0)4-67-87-61-10 
Fax. : +33 (0)4-67-70-85-44 
Email : [EMAIL PROTECTED] 
Web Site : http://www.hymatom.fr 
====================================
P Avant d'imprimer, penser à l'environnement
 


-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de wll
Envoyé : jeudi 8 novembre 2007 19:32
À : Lwip Users
Objet : [lwip-users] telnet server


Hi all,
 
 I'm using the lwip-1.1.1 with raw api, and I want to
 make a telnet server. My init function is:

void Telnet_init(void)
{
 struct tcp_pcb *ptel_pcb;
 
 //new pcb
 ptel_pcb = tcp_new();

 //Bind it to port 23
 tcp_bind(ptel_pcb, NULL, 23);

 //state to pcb LISTEN
 tcp_listen(ptel_pcb);

 //register the callback
 tcp_accept(ptel_pcb, Telnet_accept);
}

But the code in the callback Telnet_accept never run.
Looking in the stack I saw that the function
tcp_input() call to tcp_listen_input(), but the
last one do esn't call to tcp_process().

Can someone wive me an advice, regards
Med


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



_______________________________________________
lwip-users mailing list
[email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
BEGIN:VCARD
VERSION:2.1
N:BERNON;Frédéric;;M.
FN:Frédéric BERNON
ORG:HYMATOM SA;Recherche et Développement
TITLE:Chef de projet informatique
TEL;WORK;VOICE:04-67-87-61-10
TEL;WORK;FAX:04-67-70-85-44
ADR;WORK;ENCODING=QUOTED-PRINTABLE:;23;Zone Industrielle=0D=0A175 rue de Massacan;VENDARGUES;;34740;FRANCE;
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:23=0D=0AZone Industrielle=0D=0A175 rue de Massacan=0D=0AVENDARGUES 34740=0D=
=0AFrance
URL;WORK:http://www.hymatom.fr
ROLE:Chef de projet informatique
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20020404T083210Z
END:VCARD
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to