The short answer is yes.

Update:

If you want to fix up this code which I just knocked up, feel free. It's almost there. Just not all the way.
Maybe somebody else can find the problem. I have gotto fix some other stuff though.
Anyway, you should get the idea and hopefully you or somebody else can post a *completely working piece of code
so you can just go right ahead and use it*, or fix up the broken part of the following code.

Code Below blot:

If you output the data to file, then open it from your media player it works fine, it's just a small fault connection/handshake issue on the socket that doesn't allow the media player to take the binary data after it connects.

Go for your lives anybody. Like I said, I am busy with other projects that are more pressing.

Cheers.
use IO::Socket::INET; my $server; my $client; my $stream_sock_data = ""; pipe($reader, $writer); if($parent_pid = fork()) { # parent get_stream(); }else{ # child start_server(); } sub start_server { $server = IO::Socket::INET->new( LocalPort => 9999, Proto => 'tcp', Listen => '8' ) or die $!; while(my $client = $server->accept) { $resp = <$client>; if($resp =~ /GET/i) { print $client "HTTP\/1.0 OK 200\n\n"; $can_write = 1; while($can_write == 1) { $stream_sock_data = <$reader>; $can_write = print $client $stream_sock_data; } close($client); print "Client disconnected ...\n"; } } } sub get_stream { my $stream_sock = IO::Socket::INET->new( PeerPort => 8000, PeerAddr => "x.x.x.x", Proto => 'tcp' ) or die $!; print $stream_sock "GET /blahblahblah HTTP\/1.0\n\n"; $resp = <$stream_sock>; if($resp =~ /OK/i) { print "Connected to stream server ...Getting data ...\n"; while($stream_sock_data = <$stream_sock>) { print $writer $stream_sock_data; } } }

In reply to Re: From socket to socket by kabeldag
in thread From socket to socket by wizbancp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.