lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] raw api tcp_write examples....


From: Eric Shufro
Subject: [lwip-users] raw api tcp_write examples....
Date: Wed, 13 Oct 2004 17:36:56 -0400

There aren't a lot of raw api tcp_write examples available and I stumbled
into an interesting problem and would like some advice.

I have a task that pends on a semaphore and is signaled when an rs232 buffer
is ready to be transmitted via tcp.

Originally, the init code of my application created the pcb that would be
used for the transfer. 

I use the pcb and send the data, then close the connection.

Problem number 1: it seems that when a connection is closed completely, the
pcb is deallocated!

This is ok so long as its understood, but how should one go about writing an
application that waits to be signaled in order to send data?

In this case, the signal occurs, data is sent, and then the rs232 isr
signals again before the other connection is fully closed. Then, I have a
conflict over the active pcb because tcp_connect is called again with the
same pcb before it had a chance to close.

So, the question is, how should the app be designed to guarantee that the
pcb is available?

Infinite loop checking to see if pcb==NULL, then allocate a new one, use it,
close it.. and repeat the loop when signaled?

Or should semaphores be used to delay the task, in which case the in tcp.c
under the close condition, when pcb is set to null, I could signal the task?

Just wondering how others handle this given only 1 pcb to use for outgoing
data.

Thanks.

--eric shufro





reply via email to

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