CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Server-push technology ... ?

 



Woodoo
New User

Mar 8, 2003, 12:32 PM

Post #1 of 3 (1155 views)
Server-push technology ... ? Can't Post

Hi to everybody !!!

Sorry ... need your help !!! I write a Chat now and the messages update is based on " META HTTP-EQUIV="refresh ". I saw couple chats using "server-push" technology to display new messages and that looks good. It's not good method if a visitor uses Proxy ... client-pull is better in this case. But still I want to have 2 options to choose ... I was searching the Web for more info about this method ... found some examples ... tried them ... doesn't work ... Please, if someone know how to use server-pull method to display new messages - explain to me !!! Really need it !!!

Thank you a lot in advance !!!

WooDoo


(This post was edited by Woodoo on Mar 9, 2003, 7:39 AM)


Woodoo
New User

Mar 9, 2003, 8:24 AM

Post #2 of 3 (1145 views)
Re: [Woodoo] Server-push technology ... ? [In reply to] Can't Post

Well ... thanx anywy ... I've found coiple resources on the Net ... if someone needs, take a look here:

http://docs.rinet.ru:8083/WebLomaster/ch14.htm

Take care !!!


Woodoo
New User

May 27, 2003, 11:18 AM

Post #3 of 3 (1116 views)
Re: [Woodoo] Server-push technology ... ? [In reply to] Can't Post

Hi !!! It's me again ...

Well ... I've found some articles ... read them ... tried to programm the simple script and faced to one problem ... data buffering and STDIO strem flushing ...

So, here is an example how it is possible to display some lines (messages) every second ...

#!/usr/bin/perl


$Marker =
'-Marker-';
$Spacer =
" \n" x 300;

select(STDOUT);
$|=
1;

print
"Content-type: ",
"multipart/x-mixed-replace;",
"boundary=$Marker\n\n",
"$Marker\n";

$i=0;

print
"<META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html;\">\n\n",
"<body bgcolor=ffffff>\n",
"<title>test</title>\n";

while($i<
5)
{
$|=
1;

print
"I=$i<br>\n";
$i++;
print "$Spacer\n";
print
"$Marker\n";

# wait a little bit
sleep
1;
}
print
"</body>\n",

exit
0;

# end of script


So, that works fine when $Spacer = " \n" x 300; and if to look in HTML code of the Output page you will see a lot of spaces between the lines (300 times \n from line to line). Operator $|=1; has to cancel buffering but looks like it doesn't work. For a data transfer it is required certain amount of bits to send to the Client ... if you define $Spacer = " \n" x 10; or so then that will be no outprinting messages every second but all in once after several seconds when the required amount of bits is reached ... and that is sucks !!! I want to modify a chat script to support server-push technology - that saves your eyes, time and trafic ... and was trying to find some info on how to do it ... found ... tested ... and nothing works ... well ... maybe works for Netscape (as it is mentioned in many articles) but doesn't work for my IE. I saw several chats with this method working fine with IE !!! ... So, please, if someone has ideas what and how to do this stuff - share !!!

Thank you very much in advance !!!

Woodoo

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives