473,385 Members | 2,274 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,385 software developers and data experts.

In need of opinion - Should I use app.idle or something else?

I'm writing a quick application to run off of the putty app psftp. Rather than write my own ssh application I find that running a command line will get me to where I want to be but I'm running into a situation that I need some ideas on.

I'm opening a CMD using system.diagnostics and then I throw lines at the prompt using a system.io.streamwriter writeline setup, its really basic and it works.

The problem is this, I write my lines to psftp and some require a certain amount of time to run before I can throw the next line at it. For example, when I login it takes about 500 milliseconds to process the secure login and be ready for the next command. This is a pause I know has a max of 500 milliseconds so I put a Thread.Sleep(500); right after, then it writes the next step.

The step that is tough is the one that I use to move all the files in a directory on the client machine to the remote server. in psftp terms, i'm just changing the local dir "lcd C:\\temp\\" and then move all the files "mput *.*". What I would like is to create some sort of while command that will return false when the upload completes.

My first thought is to have some sort of process record the size of the current output reader (called sOut) before the upload. Then I could write my upload command and do something like

while(currentOutputSize == sOut.ReadToEnd().length)
{
//just wait till it's done...
}

But this seems more like a work around rather than good coding.

I am new to C# which is mostly why I did not want to write my own ssh ftp client, but the other side is that this program has to serve such a basic function to upload all the files in a single directory that I did not see a reason to dedicate too much time. I could also use the same thread.sleep() function here and just set it to like 30 seconds which would probably cover it every time, but then there will be the exception that requires another 5 seconds and what happens is that my app just sits hanging.

I'd appreciate any ideas or if what I was thinking is good enough then I'll stick to that route.
Mar 26 '07 #1
0 868

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Thomas Rivas | last post by:
Unable to launch IDLE(fork?) from the new Py 2.3. Anybody else have this problem. Solutions? Thanks. Tom Rivas
0
by: Paul M | last post by:
Pythoneers, IDLE doesn't use the ps2 prompt ("..." in the command line interpreter) because it supports multiline editing. This issue has been discussed before, for example see Guido's...
2
by: wrrn | last post by:
Hi - I'm beginning work on an existing web site which was created with Adobe Golive. The page in question has CSACTIONS which is part of Golive's CyberStudio. Anyway, the code below has this...
3
by: ChrisWinterscheid | last post by:
We are running DB2 8.1 on AIX 5.2. DB2level shows: DB21085I Instance "db2inst1" uses "32" bits and DB2 code release "SQL08016" with level identifier "02070106". Informational tokens are "DB2...
33
by: ram.ragu | last post by:
hi i have problem to calculate idle time of cpu and if idle time is more then i have to shut down the system. can anyone tell me the idea to so that please
5
by: sam | last post by:
hi all, i continue to footle around on my spanking new ultra 20 (1.8GHz / Opteron Model 144), gradually trying to get to grips with python and unix both. the slow print time in IDLE had...
12
by: adamurbas | last post by:
ya so im pretty much a newb to this whole python thing... its pretty cool but i just started today and im already having trouble. i started to use a tutorial that i found somewhere and i followed...
2
by: Jim Hendricks | last post by:
New to Python, and just had something strange happen. I've been running my new code in IDLE running in windows. My IDLE version shows as 1.2.1, Python version displaying in IDLE is 2.5.1. I...
9
by: timw.google | last post by:
Is there a way to disable ctrl-P (print window) in IDLE? I'm editing some python code in IDLE and I keep hitting this by mistake from my years of emacs editing. Thanks in advance.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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.