TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Simon Dahlquist
NA
5
0
How to reuse established connections
Apr 6 2010 3:17 PM
Hi!
I've used this example to create a very simple FTP client which purpose is just to download all files from an FTP server and after succeded download, delete this files from the server.
public
static
bool
DisplayFileFromServer(Uri serverUri)
{
// The serverUri parameter should start with the ftp:// scheme.
if
(serverUri.Scheme != Uri.UriSchemeFtp)
{
return
false
;
}
// Get the object used to communicate with the server.
WebClient request =
new
WebClient();
// This example assumes the FTP site uses anonymous logon.
request.Credentials =
new
NetworkCredential (
"anonymous"
,
"
[email protected]
"
);
try
{
byte
[] newFileData = request.DownloadData (serverUri.ToString());
string
fileString = System.Text.Encoding.UTF8.GetString(newFileData);
Console.WriteLine(fileString);
}
catch
(WebException e)
{
Console.WriteLine(e.ToString());
}
return
true
;
}
I've implemeted the multiple files download such as first getting the files to be downloaded into a List<string> fileList
I've added the
foreach (string file in fileList)
before the try { byte[] ... section byt this creates a new connection to the ftp server for each file.
Does anyone know how to create this multiple file download so that the established connection is reused for each file so that there will just be one used connection to the ftp server?
Is there possible to change the current uri string in an established connection?
I would be glad for any suggestions how to perform this tiny ftp client.
/Daysim
Reply
Answers (
4
)
Syncfusion 1.5.1.6: ModifyStyle does not sets all the style property to a gird in QueryCellInfo handler (Virtual Grid)
Debugging with external files and alternate load methods