Hello Every One

I had an important question regarding the closing of a TCP connection. I am
working with RAW APIs and I have to implement the following functionality
in my application :

1) I am listening on a port and once the connection is accepted I should
not be able to accept any more connections on that port. So its just one
connection per port!
2) For a reset mechanism in my application I have to implement a kill
socket like method so I have to close any connected tcp connections.

The method I have adopted so far is as follows :
1) As soon as I get a connection on my listen pcb and it enters the accept
call back function , I close the listening pcb by using
tcp_close(listning_pcb). This way its not possible to make another
connection to the listening pcb
2) If I have to close the conneced tcp pcb's I make use of the function
tcp_abort(connected_pcb).

Is this the correct way of doing it? I dont want to run into problems of
memory leaks due to faulty deallocating of the concerned PCB's.

 In one of the example templates of a receive call back function I have
seen that the function tcp_recv(connected_pcb, NULL) is called after a
tcp_close(conected_pcb) is called. Why is the tcp_recv() called after a
tcp_close() ??? Can any one explain this small doubt.

Any help is greatly appreciated

Regards
Arvind

-- 
*We are what we repeatedly do. Excellence, then, is not an act, but a habit
- Aristotle*
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to