Zarkon has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I have a problem with getting data from some streaming servers. My point is to get some data. No matter what kind of data. Just to ensure myself that the server is up and running. For example the server is at http://192.168.0.1:8090 Here is some code
#!/usr/bin/perl use Socket; require 'tv.cfg'; for my $host ( keys %televisions ) { my $port = $televisions{$host}; my $proto = getprotobyname('tcp'); socket(SOCK, PF_INET, SOCK_STREAM, $proto); my $sin = sockaddr_in($port, inet_aton($host)); connect(SOCK, $sin) || die "$host is dead !\n"; my $header = <SOCK>; print "$header\n"; exit unless($header=~m/200|OK/); close SOCK; }; Can someone help me or advice me where to look out for more informatio +n to get some data from the streaming video server?

Replies are listed 'Best First'.
Re: Perl - get HTTP streaming server data
by davorg (Chancellor) on Mar 29, 2007 at 11:59 UTC
Re: Perl - get HTTP streaming server data
by erroneousBollock (Curate) on Mar 29, 2007 at 14:15 UTC
    "Streaming" in what sense? Do you mean:
    • The server never stops sending more data in the same request (doesn't send Content-Length header), or
    • The server sends a "100 Continue" status, or
    • something else?
    The LWP classes don't seem well suited to "streaming" requests, you should probably look at using IO::Socket::INET directly.

    -David.
      Yes it doesn't send Content-Length header. The server never stops sending more data except if the server is down or crashed. Yes i think too LWP is not suitable enough for my case. I will check IO::Socket::INET.
Re: Perl - get HTTP streaming server data
by bingos (Vicar) on Mar 30, 2007 at 08:48 UTC