Skip to main content
Explorer II
January 10, 2024
Solved

LwIP Server

  • January 10, 2024
  • 2 replies
  • 3059 views

I am using a STM32H743 processor and have ST's LwIP stack running correctly. At least to the point were I can use Hercules as a client and connect to the Nucleo and send a small block of data (24 bytes) to the Nucleo. I have set breakpoints in the code and see the packet making its way to the application. This is the standard ST implementation:

void StartDefaultTask(void *argument)

{

/* init code for LWIP */

MX_LWIP_Init();

/* USER CODE BEGIN 5 */

/* ETH_CODE: Adding lwiperf to measure TCP/IP performance.

iperf 2.0.6 (or older?) is required for the tests. Newer iperf2 versions

* might work without data check, but they send different headers.

* iperf3 is not compatible at all.

* Adding lwiperf.c file to the project is necessary.

* The default include path should already contain

* 'lwip/apps/lwiperf.h'

*/

LOCK_TCPIP_CORE();

lwiperf_start_tcp_server_default(NULL, NULL);

 

ip4_addr_t remote_addr;

IP4_ADDR(&remote_addr, 192, 168, 1, 11);

lwiperf_start_tcp_client_default(&remote_addr, NULL, NULL);

UNLOCK_TCPIP_CORE();

/* Infinite loop */

for(;;)

{

osDelay(1000);

}

/* USER CODE END 5 */

}

 

The problem is I do not know how to access this data. That is, I have a CommTask in which I would like to handle the incoming data from the client. I not sure how to do this? Do I use: 'recv(s,mem,len,flags)? If so, where do I get the 's' parameter? If not, which call do I use: recvmsg; or recvfrom?

 

Thanks,

Gil

    This topic has been closed for replies.
    Best answer by Bob S

    Look for the LwIP_TCP_Echo_Server sample application.  If there is not one in the CubeH7, there is in the CubeF4 under Projects/STM32469I_EVAL\Applications\LwIP (among other places)

    2 replies

    Bob SAnswer
    Super User
    January 10, 2024

    Look for the LwIP_TCP_Echo_Server sample application.  If there is not one in the CubeH7, there is in the CubeF4 under Projects/STM32469I_EVAL\Applications\LwIP (among other places)

    Super User
    January 10, 2024