473,395 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Streaming with System.IO and System.Net

Hello,

I have an app that has a process bar on it and it sends and retrieves data
back and forth to a web page using WebRequest and WebResponse. The stream
is received from the web page and written into a memorystream then written
to a file on the hard drive. When the app's start button is clicked the
first thing that happens is that the size of the file is displayed (i.e. 51
of 562 Downloaded) untile the download is complete. The problem is that
when you click on the cancel button (to stop the download) or if you click
around the form or outside of the form, the application stops responding,
the cancel buttons event does not fire when the steaming is happening.

Any suggestions will be greatly appreciated.

Chuck
Jul 21 '05 #1
4 1071
Seems like the app crashes when focus is changed.

The focus could remain on the progressbar as I get the impression
there's really nothing the user is supposed to to until the download
is done anyway.

I'd also set a breakpoint on the Cancel button click handler.
There's housekeeping to be done there for sure.


"Charles A. Lackman" wrote:
Hello,

I have an app that has a process bar on it and it sends and retrieves data
back and forth to a web page using WebRequest and WebResponse. The stream
is received from the web page and written into a memorystream then written
to a file on the hard drive. When the app's start button is clicked the
first thing that happens is that the size of the file is displayed (i.e. 51
of 562 Downloaded) untile the download is complete. The problem is that
when you click on the cancel button (to stop the download) or if you click
around the form or outside of the form, the application stops responding,
the cancel buttons event does not fire when the steaming is happening.

Any suggestions will be greatly appreciated.

Chuck

Jul 21 '05 #2
Maybe you could launch a seprate process to do the sending and receiving of
the data which would periodically update the ui?

Because your are doing the data retrieval synchronously and therefore cannot
put doevents anywhere to allow the ui to update/check for events.

Scott Emick

"Ben Solomon" <bs****************@yahoo.com> wrote in message
news:A6**********************************@microsof t.com...
Seems like the app crashes when focus is changed.

The focus could remain on the progressbar as I get the impression
there's really nothing the user is supposed to to until the download
is done anyway.

I'd also set a breakpoint on the Cancel button click handler.
There's housekeeping to be done there for sure.


"Charles A. Lackman" wrote:
Hello,

I have an app that has a process bar on it and it sends and retrieves
data
back and forth to a web page using WebRequest and WebResponse. The
stream
is received from the web page and written into a memorystream then
written
to a file on the hard drive. When the app's start button is clicked the
first thing that happens is that the size of the file is displayed (i.e.
51
of 562 Downloaded) untile the download is complete. The problem is that
when you click on the cancel button (to stop the download) or if you
click
around the form or outside of the form, the application stops responding,
the cancel buttons event does not fire when the steaming is happening.

Any suggestions will be greatly appreciated.

Chuck

Jul 21 '05 #3
Instead of using sync apis, use the asynchronous versions of
Httpwebrequest/response. Then, in the callback handler, make sure that you
post messages to the main window.

--
feroze

-----------------
This posting is provided as-is. It offers no warranties and assigns no
rights.

See http://weblogs.asp.net/feroze_daud for System.Net related posts.
----------------

"Scott Emick" <se****@ham.fox-international.com> wrote in message
news:er**************@TK2MSFTNGP09.phx.gbl...
Maybe you could launch a seprate process to do the sending and receiving of the data which would periodically update the ui?

Because your are doing the data retrieval synchronously and therefore cannot put doevents anywhere to allow the ui to update/check for events.

Scott Emick

"Ben Solomon" <bs****************@yahoo.com> wrote in message
news:A6**********************************@microsof t.com...
Seems like the app crashes when focus is changed.

The focus could remain on the progressbar as I get the impression
there's really nothing the user is supposed to to until the download
is done anyway.

I'd also set a breakpoint on the Cancel button click handler.
There's housekeeping to be done there for sure.


"Charles A. Lackman" wrote:
Hello,

I have an app that has a process bar on it and it sends and retrieves
data
back and forth to a web page using WebRequest and WebResponse. The
stream
is received from the web page and written into a memorystream then
written
to a file on the hard drive. When the app's start button is clicked the first thing that happens is that the size of the file is displayed (i.e. 51
of 562 Downloaded) untile the download is complete. The problem is that when you click on the cancel button (to stop the download) or if you
click
around the form or outside of the form, the application stops responding, the cancel buttons event does not fire when the steaming is happening.

Any suggestions will be greatly appreciated.

Chuck


Jul 21 '05 #4
Feroze [msft] wrote:
Instead of using sync apis, use the asynchronous versions of
Httpwebrequest/response. Then, in the callback handler, make sure
that you post messages to the main window.


....and since this will be a thread pool thread, make sure that all
communications with the GUI window is through ISynchronizeInvoke.Invoke

Richard
--
www.richardgrimes.com
my email ev******@zicf.bet is encrypted with ROT13 (www.rot13.org)
Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Daniel | last post by:
streaming random filetypes from .aspx how to stream a file from inside a .aspx? e.g. so one could go href="./foo.aspx?file=bar.mp3" or href="./foo.aspx?foo.dat" etc. preferabley i would like...
2
by: mpaliath | last post by:
Hi guys I am currently involved in a project which requires me to recieve and play streaming video as well as send it. In Visual C++ is there any free library which helps me do this as...
1
by: DB | last post by:
Hi All, I’m trying to stream a PDF with .NET 2.0 in a c# web app. However, it does not actually show the PDF (using adobe acrobat). The Situation: Click on a Button, Opens a new Window,...
5
by: Manuel Alves | last post by:
Hi, Is it possible to store media files (like windows .wmv) on SQL Server 2005 and stream it back to the client via media server (not just download it)? Regards, Manuel Alves
8
by: Amjad | last post by:
Hi i am writing a application where i want to browse video file and copy data into stream and send that stream over network...I have develop P2P windows application where i successfully transfer...
5
by: pmakoi | last post by:
dear all this might be a piece of cake for some of you out there but it is causing me a lot of stress given the fact that there is not enogh documentation out there regarding this topic I am...
3
by: Brad | last post by:
I have an aspx page that is sending pdf files to client browsers: it uses a filestream to read the pdf file and response.binarywrite to send content to the browser. This has worked great for years...
2
by: Bubbs | last post by:
hi, Lemme give u a little background on my problem. Ive created a client and server applications that receive and stream live time values. The client software is a clock that receives the time and...
1
by: Almund | last post by:
Hi, I'm trying to implement streaming over http and got stuck with a problem trying to send chunks of data using the .Net NetworkStream object. All works fine as long as I send the entire data in...
1
by: Faisal Shafiq | last post by:
I want to upload a file direct to the Silverlight Streaming Service from a Web Client such as silverlight application. As per our product requirement we want to upload a .WMV file directly from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.