[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fastcgipp-users] fastcgi++ hangs when POST request is submitted
From: |
Yeshwanth Sriram |
Subject: |
Re: [Fastcgipp-users] fastcgi++ hangs when POST request is submitted |
Date: |
Wed, 25 Apr 2012 10:18:40 +0200 |
Hi Eddie Carle,
Thank you so much for your response.
The code is identical to echo.cpp except I initialize a socket and call the
manager with the sockfd. I tried with fastcgi++1.1 and I get same behavior.
I also did an 'strace' on the running fcgi and noticed that it seem to have
read the body but seems like after that it is going into an endless wait or
something. Perhaps waiting for some end of input or something. Not sure. It
will really be awesome if I can get this to work because it is for a high
volume deployment use case.
Here is the snippet.
<<<< snip >>>>
int initialize_socket(int portno)
{
int sockfd;
struct sockaddr_in serv_addr;
int n;
/// Create the socket
{
sockfd = ::socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
{
throw std::runtime_error("opening socket");
}
}
/// bind socket to port and listen
{
::bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(portno);
if (::bind(sockfd, (struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0)
{
throw std::runtime_error("binding socket");
}
::listen(sockfd,5);
}
return sockfd;
}
int main()
{
try
{
int portno = 3001;
int sockfd = initialize_socket(portno);
// First we make a Fastcgipp::Manager object, with our request
handling class
// as a template parameter.
Fastcgipp::Manager<Echo> fcgi(sockfd);
// Now just call the object handler function. It will sleep quietly
when there
// are no requests and efficiently manage them when there are many.
fcgi.handler();
::close(sockfd);
}
catch(std::exception& e)
{
error_log(e.what());
}
}
<<<< snip >>>
-Yesh