Solved

How to skip waiting responce from client in CGI

Posted on 2004-10-07
4
157 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 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

726 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