[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to skip waiting responce from client in CGI

Posted on 2004-10-07
4
Medium Priority
?
159 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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 provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

650 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