473,513 Members | 4,753 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1077
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
1422
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
9735
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
5383
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
3236
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
65792
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
3534
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
3996
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
1714
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
4434
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
2833
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
7153
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
7373
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,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7519
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5079
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.