16,018,460 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Manujith Pallewatte (Top 4 by date)
Manujith Pallewatte
21-Nov-13 5:51am
View
it wont work like that since echo $val; would output the hwole file only then it enter the sleep mode
for buffering you also have to do some browser tricks you missed in the above code [please refer that article again, you have to send the 1024 bytes + <br> before everything ]
to acheieve what you want, you have to read the file by a buffer as well
ex:
loop:
read 100 kb from the file
output 100 kb
timer++
if(timer==10) sleep(10);
like wise
Manujith Pallewatte
20-Nov-13 6:04am
View
this isnt an error, this is the directory listing
select the index.php from the directory [although it should be loaded automatically in default configuration]
Manujith Pallewatte
20-Nov-13 5:47am
View
you need to flush the buffer to break it, you need to tweak the browser to support this feature
i assume that the data you are transferring is okay with this breaking, following tip shows how to output php in realtime, in which the buffer is interrupted to show the output. Same concept can be used to tell the browser to stop receiving at a given time.
http://www.codeproject.com/Tips/680085/Real-time-Updating-of-PHP-Output
read more about http://php.net/manual/en/function.ob-flush.php (ob_flush()) as well
Manujith Pallewatte
20-Nov-13 1:05am
View
heyy,
its your good time, only last week i made a php -> js library for just this purpose :)
https://github.com/ManZzup/pjstreamer
now this is actually not made for transfering byte data, but with some modifications you can make it transfer bytes over ajax
----------------
OR you can modify the solution to buffer data than downloading periodically, that is you tell the browser that the file is buffering and the browser will download byte stream till the server stops sending