Help - Search - Members - Calendar
Full Version: FTP scriptyness
Sneaky Monkeys Forum > Support > PC, Website, Server & Game Support
MonkeyFiend
Firstly would it not be easier to script it so that a bunch of files are packaged - zipped or preferably tarred and then upload the one file then untar it on the remote server??

Something like the following run on "Remote server" => "computer where files are kept" (Dirty FTP connections*)

On server, create a local ghey.zip and fills it from the FTP request.


WebRequest.RegisterPrefix("ftp://", FtpWebRequest.Creator);
WebRequest request = WebRequest.Create("ftp://ftp.magik5likesmen.com/ghey.tar.gz");
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();

Stream local = File.Create("ghey.tar.gz");
byte[] buffer = new byte[1024];
int n;
do
{
n = stream.Read(buffer, 0, buffer.Length);
local.Write(buffer, 0, n);
}
while (n > 0);
stream.Close();
local.Close();

**then something like.. (I can't remember the syntax tongue.gif)***

gz.UnTarGz("ghey.tar.gz", untarRoot, bNoAbsolute);

Obviously this can be rejigged if you want to run as a script on the "computer where files are kept" > "Remote Server" type direction



*I do it this way so that a remote secure server never accepts inbound FTP connections, it should always initiate outbound connections by script. This means that the script can run with limited permissions e.g. run under a user to reach the outside world and place files in a given limited directory with no permissions outside of that directory. A separate script with permissions to this directory but no permissions to the outside world can then be run to unpack and palce the files where they belong; this is purely limiting security.
Magik5
yeh good idea actually, never thought of packaging up

had a quick check and php (yes php not asp tongue.gif) supports zips over tars so ill use them instead.

basically theres a php script that executes after each upload to enter each file into a mysql db ive created so ill get php to do the unzipping as well =]

cheers for the help =]
Magik5
nice idea on the security thing as well, but the only people using this will be staff uploading to our server so security shouldn't really be an issue.

i had a little dig around google as it seems c# only supports zipping one file at a time, where as i need to zip (sometimes multiple folders) containing multiple files into one zip.

the ftp app works just fine as is, albeit a few annoying 550's every so often, and ive got the rest of the php stuff to be getting on with so if theres a quick simple solution for this then great, if not its not really an issue =]

oh one more thing - on the first connection it makes, the app seems to hang until connection is made, short of going down the threading route, do you no of a quick fix for this?

cheers
MonkeyFiend
Code that I routinely steal err.. I mean utilise for zipping in #:

http://www.vwd-cms.com/Forum/Forums.aspx?topic=18

App hanging... ahh the old blocking problem... good old 'asynchronous sockets' to the rescue - basically you should be able to handle GUI and networking in 1 thread

Quickly googled: http://tinyurl.com/4jyfyt
Magik5
cheers for the links,

will look into the sockets thing if i have time near the end of the deadline as itll take me awhile to get my head round.

the zip script seems quite simple, yet kind of a hack when microsoft could have made it so much easier...

ta
Magik6
Total jiberish tongue.gif
MonkeyFiend
Well thats how I feel when I see a thread about motorbikes ohmy.gif
fido77
i don't understand most of that!!! i must need more classes!!! of course i haven't done anything with c# yet.
Magik5
before i started this i was like ZOHNOES! my first app in c#!

but then 475 lines later i feel ive done a good job =]

but then again having "jnr developer"as my job title gets me off the hook when i end up googling everything i dont know =]

pretty comfortable with programming now though, as in syntax, writing custom classes etc

i prefer as3 though, just not the authoring environment as the available code hinting is shite
Magik5
but i still dont like regular expressions :s
fido77
i'm startin to get it down. writin small programs is fairly simple to me, but i have trouble with the bigger ones. its mainly the paper work the teacher makes us do that slows me down. i figure by the time i write all the IPO charts and crap, i could have already wrote the dam program!!!
MonkeyFiend
[Warning: bad c# regex joke follows]


What regular expression can be found in December?








Answer: [^L]
fido77
i can't figure it out! whats the answer? lol.
Magik5
any character not equal to L... eh
MonkeyFiend


Sorry... I'll get my coat sad.gif
Magik5
to be fair i did laugh

for a few seconds
fido77
i had myself a laugh too! biggrin.gif
Lawpf2001
GCSE IT = name sum input devices, make a stupid database using acess for no good reason

Law
x
Magik5
i had to do that for alevels

the first time i ever saw a line of code was my first year of uni - 2 years ago lol

and that was java

oh and ive now added the starters of my image gallery to my website, found here: http://www.dancotton.co.uk/Gallery
Magik6
IT is bullshit, its more about how programs can be used etc rather than learning the how a computer processes data etc. I decided to drop IT after GCSE and take computer science instead, was much better. Although neither compares to the super cool subject of Geology!!! biggrin.gif
MonkeyFiend
I did A-level IT - the teacher (now sacked) was an old physics teacher that my school moved across in the 70's to teach computers, since physics/maths were closest to IT at the time.

He decided to split the sets based on score of a big IT test, but rather than taking the top 20 into set 1 etc., he set a hard limit e.g. Top set were people that scored over 90%.

This meant my A-level class consisted of 3 people. The only lesson he taught in 2 years was 'how binary works' The rest of the time he went into the staff room and never reappeared.

For me IT/IS and computer science were all basically the same thing.

I completed my generic spradsheets/relational database coursework and then started learning VB - probably out of boredom.

I also learnt a lot about security during this time - there were more computer rooms than computer staff, so certain people were selected as prefects to look after these rooms. My room was H6 in hawkins house - there had been a sudden upsurge in (forbidden) gaming that I was supposed to prohibit (Duke Nukem!)

During this 2 year period, the head of IT never figured it was me installing these games. It was a good situation - he kept buying security and snooping software and showing me how it worked, thereby enabling me to bypass it biggrin.gif

I suspect I learnt more through this than I would have in a traditional taught class tongue.gif
Magik5
lol

well ive learnt a hell of a lot more in this place of work where ive been for 3months, compared to my whole 2 years ive currently spent at uni

schools suck.

and why VB :s ergh shite language
MonkeyFiend
vb was part of access/excel so I started veering towards it through those sad.gif
Magik5
oo ok. your old =]
fido77
what kind of place are you working at Magik5? only thing i could do with my computer before school and =SM= is put a disk in and play it. now i gotta deside wether i want to focus more on programming or graphics. the programmers make the most money. http://www.gamecareerguide.com/features/61...ect_.php?page=2
Magik5
www.mediastation.co.uk - we are currently designing a new wesbite as the current one is quite outdated

i mainly do flash design/programming - as3 ftw =]

im currently doing a bit of php with c# because we got this job for ea - deadlines 2 weeks time tho so after that ill be going back to flash i expect

but i can use most adobe tools like photoshop, after effects/premiere/dreamweaver etc etc, and im also doing some 3dsmax work in my own time as i love all things 3d =]

i programmed about 1/2 of a 3d board game (but not the stereoscopic engine as m not that clever :s) currently on a well known companies website (pm me as im not publicly allowed to disclose who) =]

i really enjoy working for this company as they do everything i would want to do =]

i also like taking pictures... as seen um. <PLUG> here: http://www.dancotton.co.uk/Gallery </plug> heh 2 plugs in the same thread, whoo!

im still finishing my gallery, its written in as3 and reads in from an external xml file with links to the images which are also external =]

lol /fin
fido77
the pics look good, when you gonna get more. i should've took my camera with me on the roof yesterday.
Magik5
ive got 750 photos i took on my holiday to dorset i took a few weeks back, those are a select few =]
Lawpf2001
duke nukem lol. was shareware Doom for me! in the school library having a mass sesh! lol funtimes.

Law
fido77
did you do any of the work on the showreels, magik5? they're pretty neat!
Magik5
no, that was all done before i got the job =]

anyway i leave the video editing/animation/modelling to the real pr0sm im just a gay little script geek atm biggrin.gif

my latest contraption however, is this: http://www.dancotton.co.uk/Bubbles biggrin.gif

oh but i forget, you need flash player 10 beta to be able to get the best from it =[
fido77
pretty coooooooool!!! cool.gif heres my new thing i'm workin on!!!

GoochTyke
KEWL: blink.gif

heres one ive been workin on for a few weeks now



should be finished soon
Magik5
rofl
fido77
maybe i should change mine to be more like yours GoocheTyke!!! biggrin.gif it would prob come out better!
Magik6
lol Gooch
Magik5
FYI if you care or not, i dropped ftpwebrequest and used this class instead:http://www.csharphelp.com/archives/archive9.html

works much better and runs way smoother.

cheers for the help though monkey, its always appreciated =]
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.