用周立功的一个程序,ucos和lwip做了一个web服务器,开始还能正常登陆,现在网页登陆不了,可是ping能ping通,附上WEB处理代码:
static void TaskHttp(void *parg)
{
int sListen,sAccept;
struct sockaddr_in ser,cli;
u32_t iCliLen;
sListen = socket(PF_INET,SOCK_STREAM,0);
ser.sin_family = AF_INET;
ser.sin_port = htons(80);
ser.sin_addr.s_addr = htonl(INADDR_ANY);
bind(sListen,(const struct sockaddr *)&ser,sizeof(ser));
listen(sListen,32);
iCliLen = sizeof(cli);
while(1)
{
sAccept = accept(sListen,(struct sockaddr *)&cli,&iCliLen);
if (sAccept < 0) { /* accept 操作有错误 */
OSTimeDly(100);
continue;
}
if(sAccept == 0)
{
close(sAccept);
OSTimeDly(100);
continue;
}
rhb_httpd_handler(sAccept);
close(sAccept);
}
}
是不是listen函数监听的socket太多了啊,请教高手。 |