473,508 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stream Read Hangs during ftp put


I am using a StreadReader in an ftp put process.

The problem is the .Read() method can stall or hang, and there is no
built in timeout or error thrown.

Is there a way to throw an exception, or do I need to use a different
technique. I've examined at least 4 different implementations of ftp
libraries in c# and they all use the same basic code. I've also tried
using both a StreamReader and a BufferedStreamReader.

Here's where the code hangs (it gets stuck on the .Read in the while loop):

BufferedStream inputb;

while ((bytes = inputb.Read(buffer,0,buffer.Length)) > 0)
{
cSocket.Send(buffer, bytes, 0);
}

The thing is it actually does ftp the file, it's just the code gets
stuck on the final read, and can't continue to the next steps.

At this point, I am thinking of implementing a watchdog thread to throw
an error after a few seconds. I've used that in java successfully for
another project.

--
Get the new
http://www.you-read-it-here-first.com
content from Texeme Textcasting Technology
Apr 6 '06 #1
0 1314

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

Similar topics

2
3537
by: Jonathan | last post by:
Hi I'm doing a project for school and wrote an applet that makes a socket connection to a server (smae host as webserver) that was setup for this project. In the applet there are 3 buttons and by...
1
1821
by: A | last post by:
Hi all, I have an ASP page that downloads file with the ADODB.Stream object. I've found that if the user click cancel in the "Save file as" window or during the downloading, the download is no...
6
7343
by: Yechezkal Gutfreund | last post by:
I have been using the following code (successfully) to read Xml formated text packets from a TCP stream. The output from the server stream consists of a sequence of well formed Xml documents...
8
17300
by: Scott | last post by:
Hi guys, If I try to call read(), readline(), readtoend() and there is nothing to read (from a never ending loop for example) the program seems to continue but it exits the loop for no apparent...
2
2736
by: White Spirit | last post by:
I have a function within an application where a client connected to a server continuously sends data. The code on the server side is of the following form: Socket socket = receiveSocket;...
0
1840
by: lini | last post by:
Hello, I am writing some code in the scenario which can be described as follow: + program A which writes to standard output (e.g. cout >> whatever). + program B which has GUI and also listens to...
0
1703
by: heplesser | last post by:
Summary: Does the C++ standard require std::basic_istream<>::operator>>(double&) to leave the input stream untouched in case of a read failure? Details: I noticed an unexpected behavior of...
2
1338
by: Jules Winfield | last post by:
I've been experiencing a problem recently where the debugger hangs for up to ten seconds, even when executing very simple operations (i.e. adding two numbers). During the hang, a little popup...
2
1940
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
I've made a post last Friday in regards to this subject, but I'm still a little lost. I've a problem regarding reading a stream. I am connected to a port that sends information using a stream. ...
0
7133
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
7405
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...
1
7066
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5059
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
4724
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...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
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.