🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #15842

Re: linux streaming MP3 problem/question

#15842
From: Jan Panteltje
Date: Fri, 11 Aug 2000 00:00
43 lines
2990 bytes
>
Hi,
You should buffer at the receiver and send and read a lot of chars
at the same time.
Also you should do the correct error check on the read, and look for E_AGAIN.

                        bytes_read =\
                        read(sock, ucbufptr, buffer_length - bytes_received);
                        if (bytes_read < 0)
                                {
                                /* Read error. */
                                perror ("read_from_server(): read");
                                if(errno == EAGAIN) continue;
                                if(errno == EINTR) continue;
                                return 0;
                                }
                        else if (bytes_read == 0)/* EOF, connection closed by server */
                                {
                                /* we are here for example if incorrect password */
                                fprintf(stdout, "read_from_server(): EOF detected\n");

                                /* maybe close socket here */
                                return 0;
                                }
                

have a look at the internet_server.c in mcam (webcam via tcp/ip)
http://www.panteltje.demon.nl/mcam/
Not I am not using streaming, just send a frame a the time.
Still it caters for the data coming in in chunks.
(So calls to read until all data is read)
And I use select to see if data is available on the sockets.
I did try a small streaming version, but for this purpose it was not the
best solution.
Anyways, again, look at something like realplayer, it first fills a buffer,
only then it starts playing (from the buffer), while the connection keeps
the buffer filled.
The Internet cannot guarantee continuous data flow.
Please read libc.info (/usr/info/libc.info... )
it goes into much detail about all this.
Jan

 
Technical Details
Message-ID: <966004336.5373.1.pluto.d4ee0662@news.demon.nl>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <qmPk5.45$g%5.1708@nreader1.kpnqwest.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5392,7a09166187d02dc0
X-Google-Attributes: gidf5392,public
X-Google-Thread: 10c696,7a09166187d02dc0
X-Google-Attributes: gid10c696,public
X-Google-Thread: fcea4,7a09166187d02dc0
X-Google-Attributes: gidfcea4,public
From: jan@panteltje.demon.nl (Jan Panteltje)
Subject: Re: linux streaming MP3 problem/question
Date: 2000/08/11
Message-ID: <966004336.5373.1.pluto.d4ee0662@news.demon.nl>
X-Deja-AN: 657176374
X-NNTP-Posting-Host: panteltje.demon.nl:212.238.6.98
References: <qmPk5.45$g%5.1708@nreader1.kpnqwest.net>
X-Complaints-To: abuse@nl.demon.net
X-Trace: news.demon.nl 966004336 pluto:5373 NO-IDENT panteltje.demon.nl:212.238.6.98
Mime-Version: 1.0
X-Newsreader-location: NewsFleX-1.1.9.5 (c) 'LIGHTSPEED' off line news reader for the Linux platform NewsFleX homepage: http://www.panteltje.demon.nl/newsflex/ and somewhere on ftp://sunsite.unc.edu/pub/linux/
User-Agent: NewsFleX/1.1.9.5 (egcs-2.91.66 Linux-2.2.12)
Newsgroups: be.comp.programming,comp.os.linux.development.apps,comp.os.linux.development.system