?
Solved

How to skip waiting responce from client in CGI

Posted on 2004-10-07
4
Medium Priority
?
158 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 8

Accepted Solution

by:
inq123 earned 2000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
The viewer will learn how to count occurrences of each item in an array.
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 …
Suggested Courses

770 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