Jump to content

sellfisch

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sellfisch's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello everybody, i try to stream a soundfile (while recording) with an php file to a embeded(vlc plugin) media player. The Problem is, that the soundfile is still growing, so it has no final filesize and php has to send everything. My actual version is: <?php header('Content-Description: File Transfer'); header('Content-Type: audio/x-wav'); header('Content-Disposition: attachment; filename=audio.wav'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); ob_clean(); flush(); $handle = fopen("audio.wav", "r"); while (!feof($handle)) { $buffer = fgets($handle, 4096); echo $buffer; } fclose($handle); //readfile("audio.wav"); Everything works fine if the playing offset is bigger that 10-15 secounds. Otherwise the download will be aborted (i think because php thinks that the end of file is reached). But need an offset of less than 3 secounds. I hope there is a solution without the need of a streaming server. Thanks for your help
  2. You are cleaning the whole output in the end. so there is nothing to display. // Output imagejpeg($image_p, null, 100); ob_end_clean(); i think its the best to leave this buffering out
  3. I only worked with mysql until yet, but you could try: $sql="INSERT INTO tblCustomer (username, Surname, Forename, DOB, [Email Address]) VALUES ('$username', '$surname','$forename', '$dob','$email');"; $sql.="INSERT INTO tblAddress (username, HouseNumber, Street, Town, Postcode) VALUES ('$username', '$housenumber','$street', '$town','$postcode')"; if (odbc_exec($conn,$sql)...
  4. mysql_query only provide the result of an query. If you want to get the lastname for example you have to do it like this: $result = mysql_query ($sql); $lastname=mysql_result($result,0,"lastName");
  5. Maybe you sould user src instead of scr
  6. How can i edit my posts? what ever. I made a little picture about my problem. Hope its helps: Javascript can only work on the client side. So it doesn't help to detect new messages. I wan't to improve the "waiting-state" (see picture) on the serverside. How can the script know that there is a new message (in the db or where ever) without looking it up every secound (or more often). One solution i found goes the following way: A orders get.php via javascript(ajax request) get.php creates a socket for A get.php stores A's port to the database get.php of A starts listening on his port B sends a message to the server The server looks up the port of user A B sends a message to Port of A A's get.php stops listening and send the message back Javascript gets the message and send a new get-request But ther sould be a better way than using sockets. Because i think its a security risk to open up networkports for every user of your webapplication.
  7. For example you have on a chat, every user is waiting for a new message. But to ask the database every secound for a new message, will slow down your system. So it would be nice to send a request to the server and it waits with the answer until there is a new message in the system (like meebo and some other servicers do).
  8. Hi a very common problem of the http protocol is that the communications is allways initiated by the client. In my opinion the server has no real chance to push additional data after he has send its answer. As i can see from different ajax applications like Meebo or other ajax-chats. They wait with the serveranswer until something happens. But how to realize that in PHP without stressing the server? First i tried to handle events via a loop: for(;{ $result=mysql_query(Something new?); sleep(1); if(something new?) break; } echo "something new!"; But this way has to great disadvantages: Every user creates one sql-query per secound The resonse time takes up to one secound To solve the two problems i found another way to realize that: <? session_start(); set_time_limit(0); $myport=getMyPort(10000,15000); //selfwritten function which provides a free port in a given port range if(!$socket=socket_create_listen($myport)){ echo "Socketfehler"; exit(1); } $new_socket=socket_accept($socket); $buffer=socket_read($new_socket,1024); echo "something new ($buffer)"; socket_close($socket); socket_close($new_socket); This code creates a listening socket and waits for a request. This is a very nice behavior because the script is doing nothing until something sends a package to its port. Maybe you can provide another script which is able to release the event by doing: $socket=socket_create(AF_INET, SOCK_STREAM, 0)) socket_connect($socket, "localhost", $portOfTargetUser)) socket_write($socket,"stop waiting!"); socket_close($socket); But my questions is, can i realise that in a different way? Using (Networkports) seems to be very unprofessional and unsecure to me. Is it possible to get an event, when a file is changed? Or it is possible to create global events?
  9. I prefer the secound one, because it doesn't take so much db querys (in the first solution you send a query for every page)
  10. Hi there, i have a question. I am using a few classes in many of my php projects. All project have their own repository. Is it possible to make a copy of a file from one repro to another? Is it possible to change the file in one project and apply the changes to the other repros? Thanks for help
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.