lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] help request; need to get a grip of lwIP


From: mcondarelli
Subject: [lwip-users] help request; need to get a grip of lwIP
Date: Wed, 16 Nov 2011 22:17:01 +0100 (CET)

Hi,
I'm struggling with my first lwIP port.
I need to implement a few services, mostly based on TCP.

One of the first things I need to do is to create a socket to allow remote to 
connect, when this happens I should start sending some logging messages over 
the socket.
If none is connected messages are silently discarded.

My real problem is to get to the first stage of the connection.

For some tests I used apps/tcpecho_raw as template.

My main program calls (no prior lwIP code) the function IP_start(0).

---------------------------------------------------------------
struct netif netif;

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

static void ip_init(void *param)
{
   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);
   nmea_init();
}

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;
}
---------------------------------------------------------------
nmea_init() is the function that initializes my application
---------------------------------------------------------------
---------------------------------------------------------------
---------------------------------------------------------------



reply via email to

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