User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 391,596 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,706 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 1226 | Replies: 5
Reply
Join Date: Jun 2004
Posts: 604
Reputation: freesoft_2000 is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 6
freesoft_2000 freesoft_2000 is offline Offline
Practically a Master Poster

Help Ftp

  #1  
Oct 15th, 2005
HI everyone,

Let's say when i connect to a ftp do i have to worry about something called type.

I mean for example let say when connect to an ftp as such

URL url = new URL("ftp://user:pass@ftp.fileplanet.com/polo.zip");

Do i have to worry about something called type as such

URL url = new URL("ftp://user:pass@ftp.fileplanet.com/polo.zip;type=i");

Does the first way i list above work or do i have to use the second way i listed with the type for the connection to be successful.

Which of the above two ways you have used and which do you find more effective or are both the same.

If i do not specify the type by using the first way is there a default?

If i have to use the one with the type what the different kinds of types are there?

Currently i only know two which are i = image and a = ascii

Any help is greatly appreciated

Thank You

Yours Sincerely

Richard West
Microsoft uses "One World, One Web, One Program" as a slogan.
Doesn’t that sound like "Ein Volk, Ein Reich, Ein Führer" to you, too?
— Eric S. Raymond

Tell me what type of software do you like and what would you pay for it

http://www.daniweb.com/techtalkforums/thread19660.html
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,646
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 191
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Ftp

  #2  
Oct 15th, 2005
Depending on the server (whether it defaults to text mode, binary mode, or autodetects which is needed) the first may return a corrupted file.
You will get a connection in either case, but unless the data you are retrieving is text only not adding the 'i' flag may result in corruption as most ftp servers will transfer in text mode unless told otherwise.
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Join Date: Jun 2004
Posts: 604
Reputation: freesoft_2000 is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 6
freesoft_2000 freesoft_2000 is offline Offline
Practically a Master Poster

Re: Ftp

  #3  
Oct 16th, 2005
Hi everyone,

Sorry to ask this but what does a html file classify under the ftp protocol. image or ascii?

Richard West
Microsoft uses "One World, One Web, One Program" as a slogan.
Doesn’t that sound like "Ein Volk, Ein Reich, Ein Führer" to you, too?
— Eric S. Raymond

Tell me what type of software do you like and what would you pay for it

http://www.daniweb.com/techtalkforums/thread19660.html
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,646
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 191
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Ftp

  #4  
Oct 16th, 2005
the html file itself is plain text. What protocol you use to retrieve it doesn't change that.
Of course any graphics and plugins (applets, flash, etc.) linked to for embedded display will be typically binary (though you can embed plain text as well).

Linked JS and CSS are text as well.
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Join Date: Jun 2004
Posts: 604
Reputation: freesoft_2000 is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 6
freesoft_2000 freesoft_2000 is offline Offline
Practically a Master Poster

Help Re: Ftp

  #5  
Oct 16th, 2005
Hi everyone,

Originally Posted by jwenting
the html file itself is plain text

I could use binary to read a text file as well and from what i know that would not corrupt the file as long as i read all the bytes correctly back to my HD. Esentially its only a file. Like copying from place to another

I mean assuming there was a html file on the other side of the server and got its outputstream and i used the FIleOutputStream and read the html file back to HD. That would work as well would it not.

Correct me if i am wrong

Richard West
****************************************************
Microsoft uses "One World, One Web, One Program" as a slogan.
Doesn’t that sound like "Ein Volk, Ein Reich, Ein Führer" to you, too?
— Eric S. Raymond

Tell me what type of software do you like and what would you pay for it

http://www.daniweb.com/techtalkforums/thread19660.html
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,646
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 191
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Ftp

  #6  
Oct 17th, 2005
Of course. You can read a text file in binary mode without it getting corrupted, but not vice versa.

Not quite sure, but I think binary mode adds a layer of encoding to the transfer to ensure no data is lost (this is transparent).
FTP was originally created to transport only text data, and if I'm not mistaken uses 7 bits per byte (discarding one) just like SMTP.
Therefore binary data needs to be encoded from 8 down to 7 bits before being sent over the line.
Text data already fits in 7 bits (unless it's UTF-8 for exampl with the high bits in use, for example Chinese) and therefore needs no special treatment.
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Java Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 11:36 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC