Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 78076 Details for
Bug 202758
[ftp] ftp hangs when I try to copy some files to a remote site
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
A code snippet that makes ftp hang (from time to time)
clipboard.txt (text/plain), 1.26 KB, created by
Michael Scharf
on 2007-09-11 12:40:14 EDT
(
hide
)
Description:
A code snippet that makes ftp hang (from time to time)
Filename:
MIME Type:
Creator:
Michael Scharf
Created:
2007-09-11 12:40:14 EDT
Size:
1.26 KB
patch
obsolete
>import java.io.FileInputStream; >import java.io.IOException; >import java.io.OutputStream; > >import org.apache.commons.net.ftp.FTP; >import org.apache.commons.net.ftp.FTPClient; > >public class FTPClientTest { > > /** > * @param args > * @throws IOException > */ > public static void main(String[] args) throws IOException { > String remoteParent="/x"; > String localFile="C:\\tmp\\hijacked_blog\\index.html"; > String remoteFile=Math.random()+"index.html"; > String hostname="scharf.gr"; > String username="scharf.gr"; > String password="*****"; > > FTPClient ftpClient = new FTPClient(); > ftpClient.connect(hostname); > ftpClient.login(username,password); > ftpClient.enterLocalActiveMode(); > ftpClient.sendNoOp(); > ftpClient.setFileType(FTP.ASCII_FILE_TYPE); > ftpClient.changeWorkingDirectory(remoteParent); > FileInputStream input = new FileInputStream(localFile); > OutputStream output = ftpClient.storeFileStream(remoteFile); > > long bytes=0; > byte[] buffer = new byte[4096]; > > int readCount; > while((readCount = input.read(buffer)) > 0) > { > bytes+=readCount; > output.write(buffer, 0, readCount); > } > > input.close(); > output.flush(); > output.close(); > ftpClient.completePendingCommand(); > System.out.println("done"); > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 202758
:
77956
|
77957
|
77976
|
77991
|
78057
| 78076 |
78218
|
78220