lwip-users
[Top][All Lists]
Advanced

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

RE : [lwip-users] telnet server


From: Frédéric BERNON
Subject: RE : [lwip-users] telnet server
Date: Thu, 8 Nov 2007 20:03:32 +0100

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 : address@hidden 
Web Site : http://www.hymatom.fr 
====================================
P Avant d'imprimer, penser à l'environnement
 


-----Message d'origine-----
De : address@hidden [mailto:address@hidden 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
address@hidden http://lists.nongnu.org/mailman/listinfo/lwip-users

Attachment: Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf


reply via email to

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