lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] disconnect - connect delay


From: Bill Auerbach
Subject: RE: [lwip-users] disconnect - connect delay
Date: Fri, 1 Apr 2011 16:48:39 -0400

>Did you use it in HTTP server code? When I abort the multiple
>connection in the accept callback the web browser don't load all the
>webside elements. If browser get RST flag in TCP packet it doesn't try
>to download the element again. In firebug it is shown as Abort state
>instead of "200 OK".
>
>As you can see aborting connection can't be use in HTTP protocol. Or
>maybe I'm doing something wrong.

It will work if you refuse multiple connections from *different* IP
addresses.  In the accept handler if the ip address is the same as the first
accepted connection, allow it, otherwise refuse it.  I believe this is what
you really want to do - refuse connections from different IP addresses, yes?
Below acceptedPcb is the first pcb accepted and is set to NULL when the last
connection closes.

static struct pcb *acceptedPcb;

static err_t    accept(void *arg, struct tcp_pcb *pcb, err_t err)
{
    if(acceptedPcb != NULL && acceptedPcb->remote_ip.addr !=
pcb->remote_ip.addr)
        {
        tcp_close( pcb );
        return ERR_OK;
        }
.
.
.
.
}

Bill




reply via email to

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