lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Problems with netcopnn_recv


From: Soldavin, Keith A.
Subject: [lwip-users] Problems with netcopnn_recv
Date: Tue, 1 Dec 2015 18:10:16 +0000

Hello,

I am developing an application that needs to sit on a network and receive UDP data and process it. As of now it only needs to listen for data, not send any back. I am using the latest LWIP 1.4.1 from the repository as of a month ago on a STM32 and FreeRTOS. I am having an issue that I am only receiving the first message that is being sent and then no others. I did some digging and I can see that before I do the netconn_bind(), I am seeing all the messages come into the “ethernetif_input” function but as soon as I bind the port I don’t see any other messages. I also found that if I send the received message right back to the sender, the netconn_recv functions starts working again and will grab the next message. Unfortunately this is not a viable solution. Below is the code I am using for the receive task.

 

static struct netconn *connAircraft;

               

static void vReceiveTask(void *arg)

{

                err_t err;

                uint8_t initComplete = FALSE;

                uint32_t mavMsgLen = 0;

                struct netbuf *buf;

                static uint8_t dataBuffer[255];

                uint8_t *dataPtr = &dataBuffer[0];

               

                while (1)

                {

                                if (initComplete == FALSE)

                                {

                                                /* Create a new connection identifier. */

                                                connAircraft = netconn_new(NETCONN_UDP);

 

                                                /* Bind connection to a port. */

                                                err = netconn_bind(connAircraft, NULL, (uint16_t)AircraftUDPPort);

                                               

                                                initComplete = TRUE;

                                }

 

                                while ((err = netconn_recv(connAircraft, &buf)) == ERR_OK)

                                {

                                                // There was data received. process it

                                                mavMsgLen = netbuf_len(buf);

                                                netbuf_copy(buf, dataBuffer, mavMsgLen);

                                                dataPtr = &dataBuffer[0];

 

                                                // Process the data Here

 

                                                netbuf_delete(buf);

                                }

                }

}

 

 

Does anyone have any thoughts? I have been trying to get this to work for severals days now and I know if has to be something stupid I’m missing.

 

Thanks
Keith


reply via email to

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