Click here to Skip to main content
15,892,298 members

Comments by vicky87 (Top 42 by date)

vicky87 16-Aug-11 11:46am View    
thanks

but i like to create on function which tick_time and process that tick_time

public void TimeCheck(string handler)
{
Timer time = new Timer();
time.Elapsed += new ElapsedEventHandler(handler);
time.Interval = (1000) * (1);
time.Enabled = true;
time.Start();

}

i pass the values and it process it other wise i have to create many time function .
vicky87 15-Aug-11 4:01am View    
@christian the this is that i am PHP developer and my bro need to make few changes in C# program and i have not worked on C# programing much ..and you are right need some beginners books for this :)..
vicky87 12-Aug-11 17:18pm View    
i have mange to upload the file but can any one tell me how i can upload file after every 5 minutes ..by using any loop or some using some time function
vicky87 12-Aug-11 16:44pm View    
yes i have change the username/password so no one can see :) and i have add my program into my windows firewall but still same error.
vicky87 12-Aug-11 16:11pm View    
hii am trying this but giving me error "unable to connect to server"

static void Main(string[] args)
{
StreamReader streamReader = new StreamReader("C:\\wamp\\www\\FTCPC\\logfile.txt");
ArrayList lines = new ArrayList();

string line;

while ((line = streamReader.ReadLine()) != null)
{
lines.Add(line);
}
streamReader.Close();

if (lines.Count > 0)
{
Console.Write(lines[lines.Count - 1].ToString());

}

// Get the object used to communicate with the server.
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.contoso.com/test.htm");
request.Method = WebRequestMethods.Ftp.UploadFile;

// This example assumes the FTP site uses anonymous logon.
request.Credentials = new NetworkCredential("username", "Password", "ftcpcm.site90.com");

// Copy the contents of the file to the request stream.
StreamReader sourceStream = new StreamReader("C:\\wamp\\www\\FTCPC\\logfile.txt");
byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();
request.ContentLength = fileContents.Length;

Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();

FtpWebResponse response = (FtpWebResponse)request.GetResponse();

Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);

response.Close();



Console.WriteLine("\\n");
Console.ReadLine();

}