Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:37:38+00:00 2026-06-05T01:37:38+00:00

When the LwIP netconn_accept() or netconn_recv() function is called, if we are using a

  • 0

When the LwIP netconn_accept() or netconn_recv() function is called, if we are using a RTOS, it will block the thread and wait for a connection until timeout or forever, depends on the setting of LWIP_SO_RCVTIME0. The timeout duration is equal to the SYS_ARCH_TIMEOUT.

The SYS_ARCH_TIMEOUT is defined as 0xffffffff in the core include part of the LwIP stack, so I think it is not expected to be changed.

Actually, I want it to check if a connection is made, if not then it continue the thread. However, if I call netconn_accept(), it will just block the thread and wait there forever (or a very long time)…I don’t want to jsut change the define value of SYS_ARCH_TIMEOUT because I need different timeout in different situation…

What is the good way to do that? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:37:43+00:00Added an answer on June 5, 2026 at 1:37 am

    Polling for TCP connection (or acceptance) is usually a bad practice. Consider spawning a new thread dedicated exclusively to the blocking netconn_accept() call.

    I understand the limitations of using RTOSes, but spawning just one helper thread with minimal stack space shouldn’t be a major problem.

    I believe that implementing a solution to the classical Producer-Consumer problem is not that hard.

    If you’re talking about the FreeRTOS, it has all the tools needed – semaphores and threads.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using lwIP on an embedded device, and I feel that I may be
I am writing a C program using LwIP with FreeRTOS for an embedded device,
I've developed an lwip client on a microcontroller that does seem to successfully acquire
I am trying to run the sample code for tftp server. I get no
Target hardware is a rather low-powered MCU (ARM Cortex-M3 @72MHz, with just about 64KB

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.