Solved

How to skip waiting responce from client in CGI

Posted on 2004-10-07
4
154 Views
Last Modified: 2013-12-25
cgi perl, apache2
code:
-------
    my $html = ".... any html code";
    print $html;
    exit;
------
Problem is: after "print $html"  script waits from 0.03 to 30 seconds (possible for client to confirm reception from http server).
Is it possible to skip this delay and exit immediately from script?

Thanks
0
Comment
Question by:VadimS
4 Comments
 
LVL 8

Accepted Solution

by:
inq123 earned 500 total points
ID: 12260084
Hi VadimS,

That could be tricky and I have no way/thought of no way to test my solutions out.  But you could try two things:

1. Set $| = 1;  This probably won't work to solve the problem, but could help.
2. Try set STDOUT to non-blocking.  Worth a try:
use Fcntl;

$flags = '';
fcntl(STDOUT, F_GETFL, $flags) or die "Couldn't get flags for HANDLE : $!\n";
$flags |= O_NONBLOCK;
fcntl(STDOUT, F_SETFL, $flags) or die "Couldn't set flags for HANDLE: $!\n";

Even if this doesn't work for print, you could try to use syswrite(STDOUT, $buffer, length $buffer);

Cheers!
0
 
LVL 5

Expert Comment

by:ITcrow
ID: 12442588
It is perfectly okay, atleast with my tests with Apache.
Apache takes care of it. I even tried printing enormous data from script and it all shows up on the client without a hiccup.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question