|
From: | Frédéric BERNON |
Subject: | Re: [lwip-users] Limit tcp_listen to single connection |
Date: | Wed, 10 Oct 2007 21:36:59 +0200 |
Hi,
Except set MEMP_NUM_TCP_PCB=1 in your
lwipopts.h, I don't think there is a way to do that with tcp_listen. Even in
socket layer, with "lwip_listen(int s,
int backlog)", the
"backlog" parameter is not used. But you can close as soon as possible any new
connection: to do that, you can use a boolean initialized to false, and in
"accept" callback (set by tcp_accept), you do something like
this:
int connected=0;
static err_t accept_function(void *arg,
struct tcp_pcb *newpcb,
err_t err)
{ if (connected) {
tcp_close(newpcb);
} else {
connected=1;
/* your normal accept behavior
*/
}
}
and when you have finish to use your "single"
connection, you reset connected to 0.
----- Original Message -----
|
[Prev in Thread] | Current Thread | [Next in Thread] |