lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] trouble sending data between sockets over loopback


From: Timm Hannon
Subject: [lwip-users] trouble sending data between sockets over loopback
Date: Wed, 8 Sep 2010 16:36:16 -0700

Hi,

I am currently using lwIP in a multi-threaded environment.  >From the user list it's clear that reading and writing from different threads is unsupported, but what about have two threads in a system that communicate over the sockets?  I am running on an embedded platform that doesn't have an ethernet if, it just sends and data internally between sockets over the network stack on the loopback if.  Should this work?

My thread setup is as follows:
Thread 1: This thread waits on select for one side of all open connections.  It reads data from a socket if it is ready and sends any data that it needs to its sockets.  This is the main thread that creates connections when needed.
Thread 2: This is a thread that waits on a listen on a port for connections from thread 1.  If it receives a connection it spins off a new thread with the socket that was created.
Threads 2.1-2.x: Is passed the socket created from thread 2 and sends and receives data between itself and thread 1.  There is one of these threads for every connection made between
Thread 3:  Same as thread 2, just a different port.
Threads 3.1-3.x: Same as threads 2.1-2.x.

If I only create one connection between thread 1 and 2 (spinning off only thread 2.1), everything works correctly.  If, however, I make simultaneous connections to thread 2 and 3 or multiple connections to thread 2 (spinning off more than 1 thread waiting on the same port but different socket) the system is left with unacked data in the queue.

Doing some basic debugging it looks like the data is still in the system, but doing a read select on the port that should be receiving the data, doesn't return that their is data ready.

I can also provide my settings files and debug output if needed/helpful.

Thanks for your help,
Timm
reply via email to

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