- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Has anyone come a cross an issue with setting a non-blocking socket in LWIP. I did the following: if ((pNetworkManager->fd_socket = socket(AF_INET, SOCK_STREAM, 0)) < 0) { die_with_error("CreateSocketTask: Socket creation failed"); } u32_t on = 1; if (lwip_ioctl(pNetworkManager->fd_socket, FIONBIO, &on)) { close(pNetworkManager->fd_socket); } ... which appears to be supported by LWIP but my socking is still blocking. Any ideas or thoughts would be greatly appreciated.Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure if you can create a socket that is non-blocking per se (I am not a sockets expert), but I do know you can to send() and recv() non-blocking; the data is just posted to the stack and gets sent later, or in the case of recv(), you get back an error if nothing (or less than your desired number of bytes) was received.
Check out the web_server example design, http.c, and look at how sends and receives are done. This example shows non-blocking I/O so that multiple web clients can be served at the same time.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page