sub httpserv { my $socket = shift; my $buf; while(defined($buf = <$socket>)) { # nothing } print $socket "HTTP/1.0 200 OK\n"; print $socket "Cache-Control: no-cache \n"; print $socket "Server: Apache/2.2.23(Fedora)\n"; print $socket "Connection: close \n"; print $socket "Content-Type: text/html; charset=UTF-8\n"; print $socket "\n\n"; # Without this browser doesn't show HTML Content print $socket "
##
sub httpserv
{
my $socket = shift;
my $buf;
while(defined($buf = <$socket>)) {
last; # Without this it is like removing autoflush(1),
# Without the "last;" the client connection hangs;
}
print $socket "HTTP/1.0 200 OK\n";
print $socket "Cache-Control: no-cache \n";
print $socket "Server: Apache/2.2.23(Fedora)\n";
print $socket "Connection: close \n";
print $socket "Content-Type: text/html; charset=UTF-8\n";
print $socket "\n\n"; # Without this browser doesn't show HTML Content
print $socket "\n";
print $socket "Got your message \n";
print $socket "Got your message\n";
$socket->close();
}