Checking if connection is still open

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Checking if connection is still open

Mateusz Plocinski-2
Hi,
I'm building my application using FreeRTOS+lwip example from FreeRTOS
distribution (on ARM7 microcontroller). I've built an application
which works as audio server sending audio samples over TCPIP to PC.
My problem is following:
I have 2 TCP connections using API
- one for sending data
- one for receiving commands
Question is: how can I check, if it is still open? I need to know if I
can still send data over connection. Normally i was using following
statement:

while ((netconn_peer(pxNetCon, NULL, NULL) == ERR_OK)){
"send data if it is available, aquisition of next data from ADC, send
data, etc."
}

And it worked fine in situations when my app was sending much data
frequently. After disconnection on PC side, my app jumped out of the
loop and started waiting for next connection.
But when, after openning connection from PC side, my app dont send
anything, or stop sending for longer time, or if connection is closed
from PC side right after opening - my application thread still sits in
this WHILE loop after disconnect, so it cant accept next connection,
anything I can do is to reset microcontroller.

Is there any way to check the connection state? Please help, because
this problem blocks the development of my application.

Mateusz Plocinski


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users