Click here to Skip to main content
12,760,727 members (34,106 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# FTP
Could any guide for giving right values LIKE(HOST,USERNAME,PASSWORD)

I am Getting this exception like:SOCKET EXCEPTION CAUGHT

static string host = "";
        static string user="DIPL/SivaRamGopal.v";
        static string password="123456aA";
        static string path = "SubscribersList.csv";
        static List<string> files = new List<string>();
        static string dest_dir = "";
        static bool is_anonymous = false;
        static bool rename_destination = false;
        static bool show_help = false;

        static readonly ILog log = LogManager.GetLogger(typeof(Program));

        static void Main(string[] args)
            using (var db = new Provisioning.Data.ProvisioningWorkUnit())

                var list = db.FullfillmentServiceTrackLog.Get(x=>x.IsAPI==false);
                FileStream stream = new FileStream("SubscribersList.csv", FileMode.Create);

                ExcelWriter writer = new ExcelWriter(stream);

                writer.WriteCell(0, 0, "Msisdn");
                writer.WriteCell(0, 1, "ServiceType");
                writer.WriteCell(0, 2, "DateOfRequest");
                int count = 1;

                foreach (var item in list)
                    writer.WriteCell(count, 0, item.Msisdn);
                    writer.WriteCell(count, 1, item.ServiceType);
                    writer.WriteCell(count, 2, item.CreatedOn.ToString());

                writer = null;
                stream = null;
                FTPClient.FtpClient ftp = new FTPClient.FtpClient(host, user, password);
                Console.WriteLine("Connecting to ftp server {0}", ftp.Server);
                Console.WriteLine("Connnected to ftp server.");
                log.InfoFormat(string.Format("Uploaded successfully"));
                Console.WriteLine("Uploaded to ftp server");

Posted 22-Dec-12 20:45pm
Updated 22-Dec-12 20:47pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Since you're using a custom FTPClient library that we know nothing about, it's impossible for anyone to tell you what the problem is.

If you've got that FTPClient library from some vendor, you're best source of information is that vendor.

If you wrote it yourself, we'd need to see the relevent source code for the login method.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

How to: Upload Files with FTP[^]
and have a look at these threads
Catching a Socket Exception in C#[^]
and where is your catch/finally part of the exception handling

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170217.1 | Last Updated 23 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100