I'm trying to convert a chat script I have from one server to another. On the original server, it works fine as printed. However, on the new one I'm having issues with it.
Here's a clip of the trouble-spot:
open (SOMEOUT,">&STDOUT");
print SOMEOUT "HTTP/1.0 200\n";
print SOMEOUT "Content-type: text/html\n\n";
print SOMEOUT "Text goes here\n";
print SOMEOUT "$line";
print SOMEOUT "<SCRIPT> scroll(); </SCRIPT> \n ";
close (SOMEOUT);
open (SOMEOUT,">&STDOUT");
Basically it repeats those last few lines for a while, each time a new line of input is written to the server, it reads it into the program, prints it to the output, and then waits for the next line of input to appear.
Here's the issue.
On the old server, when it got to the close command, it would display onscreen all the information it had, then open the STDOUT again to add a line to it, close it to display that line, etc. With the new one, it doesn't do any of that. It just sits there and displays absolutely nothing. There's a time-out built in (to prevent idle processes from eating CPU forever) so once that expires and the SOMEOUT is closed for good and the script ends, it displays onscreen everything that it was supposed to have been showing all along... so I know that it's getting all that information properly. It just refuses to build the screen as it goes.
Anybody have any idea why this would be? Any suggestions for how to fix it? Or, barring suggestions for that, does anybody have any good suggestions for other ways to create a streaming output to an HTML page that doesn't require constantly refreshing the page?
Thanks for any help you can give!
Mael
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.