lwip-users
[Top][All Lists]
Advanced

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

Re: Re: [lwip-users] is it possible to have ppp without an os?


From: hnclcj
Subject: Re: Re: [lwip-users] is it possible to have ppp without an os?
Date: Wed, 23 Dec 2009 16:34:31 +0800


How such a code does not work? Under the guidance of friends who have the time?
I would like to implement a simple test page WEB
This code can Mody?
 
 
 
THANKS
 CaiJie
 
 
 
const static char http_html_hdr[] = "HTTP/1.1 200 OK\r\nContent-type: text/html\r\n\r\n";
const static char http_index_html[] = "<html><head><title>Congrats!</title></head><body><h1>Welcome to our lwIP HTTP server!</h1><p>This is a small test page.</body></html>";
 
 
void http_server (void *pdata)
{
    struct sockaddr_in ser;
    struct sockaddr_in cli;
    u32_t              n;
    u32_t              rxlen;
    int                lists;
    int                news;
    char               RxBuf[200];
    lists               = -1;
    news                = -1;
    n                   = sizeof(ser);
    cli.sin_len         = sizeof(cli);
    cli.sin_family      = AF_INET;
    cli.sin_addr.s_addr = htonl(INADDR_ANY);
    cli.sin_port        = htons(80);
    lists               = socket(AF_INET, SOCK_STREAM, NETCONN_TCP);
    bind(lists, (struct sockaddr *)&cli, sizeof(cli)); //
    listen(lists, 5);   
    while(1) {
        news  = accept(lists, (struct sockaddr *)&cli, &n); 
        rxlen = recv(news, RxBuf, 100, 0);
        if (rxlen > 5) { // "GET ..."
            _nop_();
            send(news, http_html_hdr,   strlen(http_html_hdr)-1,   0);
            send(news, http_index_html, strlen(http_index_html)-1, 0);
        }
        closesocket(news);
    }
}
 
 
 
 
 
 
2009-12-23

hnclcj

发件人: address@hidden
发送时间: 2009-12-23  00:18:36
收件人: Mailing list for lwIP users
抄送:
主题: Re: [lwip-users] is it possible to have ppp without an os?
Rigoberto Bermúdez wrote:
> excellent! but 1.3.1 *is* released, you mean 1.3.2?
>    
Herm, yeah, 1.3.2, not 1.3.1. Sorry to confuse you.
Simon
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users

reply via email to

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