|
No problem.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
HI,
I'm using FtpWebRequest class to provide ftp communication in my application. All is fine, except it sometimes fails. I've tried everything what I could, it just sometimes fails - throws
System.Net.WebException: The remote server returned an error: (500) Syntax error, command unrecognized.
at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
at System.Net.FtpWebRequest.RequestCallback(Object obj)
at System.Net.CommandStream.Abort(Exception e)
at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage)
at System.Net.FtpWebRequest.GetResponse()
To be more specific - it is download command (WebRequestMethods.Ftp.DownloadFile).
It runs on a speparate thread in background worker, code :
<br />
FileStream clientStream = new FileStream(this.DestinationPath, FileMode.Create);<br />
FtpWebResponse response = (FtpWebResponse)this.Request.GetResponse();<br />
this.GotResponse = (response != null);<br />
<br />
Stream ftpStream = response.GetResponseStream();<br />
<br />
this.ContentLength = response.ContentLength;<br />
<br />
int bufferSize = 2048;<br />
int readCount;<br />
byte[] buffer = new byte[bufferSize];<br />
<br />
readCount = ftpStream.Read(buffer, 0, bufferSize);<br />
<br />
long dataTransfered = 0;<br />
<br />
while (readCount > 0)<br />
{<br />
if (this.Worker != null && this.Worker.CancellationPending)<br />
{<br />
canceled = true;<br />
this.Request.Abort();<br />
break;<br />
}<br />
<br />
this.CheckPause();<br />
<br />
lock (this)<br />
{<br />
this.lastLoadedSize += readCount;<br />
} <br />
<br />
dataTransfered += readCount;<br />
<br />
clientStream.Write(buffer, 0, readCount);<br />
<br />
if (this.ContentLength > 0)<br />
{<br />
int completed = Convert.ToInt32(((float)dataTransfered / (float)this.ContentLength) * 100);<br />
this.ReportProgres(completed);<br />
}<br />
<br />
readCount = ftpStream.Read(buffer, 0, bufferSize);<br />
}<br />
where this.Worker - Worker object that provides thread for running.
I dont know if it is a problem inside WebRequest class or in my code(where ???) .
Thanx for any help!!
|
|
|
|
|
Chances are the server doesn't understand one of the commands being sent. Check out this[^] for more information.
|
|
|
|
|
I can't open the link you posted.
|
|
|
|
|
I had a similar problem when accessing Microsoft's forums site through IE. Try flushing your cache (and delete any microsoft.com cookies) or switching browsers.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
I did in diffrent explorer
|
|
|
|
|
I don't thing that server doesn't recognize that command, because it works most of the time. It fails only from time to time, unpredictably.
It's behavior is like races when doing multi threading (of course it is done using separate threads, but the whole operation runs on one thread -> Get Response, Download data (write data to HDD), Close stream).
I'm desperate
|
|
|
|
|
The link that partymonkey posted has a method for gathering some trace information, which may help you debug the issue.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
I've created that log, it seems that it might be helpful, thanx.
|
|
|
|
|
how can i make item in combobox invisible? the item is in middle of combo if i remove it. it will effect the whole indexing so i want to make it invisible
|
|
|
|
|
Hi,
I don't think that it's possible to make it invisible.
if u can't rely on indexes, create wrapper for your object, where U can add a int field with index(key, whatever). Then just get the SelectedItem and if it's not null, read that item index. Override ToString() method of your wrapper object, to make combobox display whatever tou want to display.
Stevo
hope that helps
|
|
|
|
|
I have one simple but difficult problem:
I plot some lines in a panel with Graphics in C#, now I want to select one of them to edit it.
I don't know how to select it?
xiachunmin
|
|
|
|
|
Hello,
You have to do it all by yourselve, AFAIK.
I think the fastest way is to handle the MouseDown and MouseUp event of the Panel.
Save the two MousePoints, as this will discripe an rectangle, SelectionRectangle.
Then you have to iterade over all your lines and validate each of the lines.
You could use the IntersectsWith method of the Rectangle class for that.
Hope it helps!
All the best,
Martin
|
|
|
|
|
Not as simple as you might think. You have to specify your problem a bit more clearly.
What exactly is it that you want to select? The lines that you have drawn doesn't exist as lines any more, they are just differently coloured pixels on the screen, so what you have to select is something that you use to keep track of the lines. How do you keep track of the lines?
What method do you want to use for selection? Detecting mouse clicks?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello, Guffa,
Thanks a lot.
You are right by saying “The lines that you have drawn doesn't exist as lines any more, they are just differently coloured pixels on the screen”.
That is the reason I can not select it by mouse clicks. I want to find some solution to keep track the lines, just like in MS word, after you plot one line, then you want to select it and edit.
Could you please tell me the best method to realize it?
Thanks a lot again.
Chunmin
|
|
|
|
|
The normal way to do this is to represent the line as an object in it's own right. Then the line could detect the MouseClick event and respond to it however you want.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete is right, you have to represent the lines as objects in your code somehow.
If you don't already do this, then you aren't drawing the lines correctly. You need to keep track of the lines in order to properly draw them in the Paint event of the control. If you just draw the lines outside the Paint event, they are just drawn on the screen where the control happens to be, and the control is not at all aware of the lines. Whenever the controls is redrawn for any reason, the lines will disappear.
---
single minded; short sighted; long gone;
|
|
|
|
|
Your best bet is to derive a class from the panel class, so you can centralise and reuse the code. The panel would keep an array of Line objects ( you would defne this class, it would have two points ), and then your code would work out which line is selected ( this is probably the hardest part, working out if someone has clicked on an arbitrary line. It's well documented online tho, and not THAT hard ).
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
do you prefer to use Dataset or direct SqlCommand to update your DB ??
for .net 2003
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
I am using a direct SQL query to update my database.
|
|
|
|
|
do you suffer from marinating string ??
and what are the advantages of direct SQL queries
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
The update methods of dataset are quite useful when you are dealing with bulk of data. For single or a few records it doesno't matter whether you use sql or bulk update.
Stored procedure are better than sql statements with respect to faster execution as they are compiled and the sql gets compiled runtime.
|
|
|
|
|
Hi
I've to transmit live video 4m Server to multiClients and I m working in C#,using UDP and capturing video from webcam in .avi format.Some1 suggested me to use Windows Media Services Now plz tell me what steps I should follow 4 transmission of live video?
How would I stream the video.I m not getting help in this matter from net so plz help me out.
thanx
Shanzay
|
|
|
|
|
Hello,
I am having Form based application. I am creating another form on menu click of main application. I want to acess the parenter or creater of the second form within the second form.
For ex.
In Form1 Menu click
Form2 ob = new Form2()
ob.MdiParent = this
ob.show()
within Form2(Save button click) i want to access the parent
Object ob = this.Parent;
or
object ob2 = this.MdiParent
but all parents are null.
What else to be done?????
Thanks.
|
|
|
|
|
Send a reference to the first form along to the constructor of the second form, and store that reference as a variable in that form class.
---
single minded; short sighted; long gone;
|
|
|
|