事件循环如下:
while(1)
{
if ((new_socket = accept(server_fd, (struct sockaddr *)&address, (socklen_t*)&addrlen))<0)
{
perror("In accept");
exit(EXIT_FAILURE);
}
char buffer[30000] = {0};
valread = read( new_socket , buffer, 30000);
printf("%s\n",buffer );
}
我打算将上一个http请求排队。然后在以后用
将其回复给客户write(new_socket , hello , strlen(hello));
close(new_socket);
但是,只要我不写就阅读它,我就会被阻止,因此我无法获取新的传入http并将其排队。实现已读过的http队列的正确方法是什么?