[Top][All Lists]

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

[lwip-users] Almost there, but not really

From: mcondarelli
Subject: [lwip-users] Almost there, but not really
Date: Thu, 17 Nov 2011 12:58:35 +0100 (CET)

I'm making progresses, but I'm still missing something.

I attach the complete source of a stupid application that, currently, just 
receives packets and (assuming that is plain ascii) puts the payload into a 
When a line is complete ('\n' is in the string) it sends back a packet with the 
complete line.
I know quite well this is not the smartest way to do an echo, but I'm focusing 
on understanding how lwIP is supposed to work.

I am testing this with a plain telnet client.

Basic works:
I can get connection
I get the first incoming line
I send the echo back
Echo arrives to testing telnet
Ack packet is sent back

At this point something goes wrong:
I get the "Got packet" debug message, but nothing else.
In particular ip_nmea_sent() is never called.

Any packet sent from testing telnet is received and the "Got packet" message is 
displayed, but nothing else happens, so I think it's not dispatched.

What did I forget?
Can someone help me, pretty please?
It seems I didn't re-trigger packet dispatching, but I have no idea where to 

Thanks in Advance

Below You can find the code I use to start lwIP, if useful.
struct netif netif;

/* static port number; workaround for lwIP slipif deficencies */
int slipif_port = -1;

static void ip_init(void *param)
   /* startup defaults (may be overridden by one or more opts) */
   IP4_ADDR(&gw, 192, 168, 0, 1);
   IP4_ADDR(&ipaddr, 192, 168, 0, 2);
   IP4_ADDR(&netmask, 255, 255, 255, 0);

   netif_add(&netif, &ipaddr, &netmask, &gw, NULL, slipif_init, tcpip_input);

error_t IP_start(u8_t port)
   if (slipif_port != -1)
      main_debug_printf("IP_start: already initialized!\r\n");
      return FAILURE;
   slipif_port = port;

   tcpip_init(ip_init, NULL);
   return SUCCESS;

Attachment: ip_nmea.c
Description: Text Data

Attachment: ip_nmea.h
Description: Text Data

reply via email to

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