Hi again Daniweb!
Im just fishing for ideas here, Im not a great coder - I'm currently working with c#.net in visual studio.
a new jpeg is being posted to the ftp server every 3 seconds...I want a client side app that can dowload this new jpg every 3 seconds...the ftp server requires user to login to get the file. hopefully this would be usable from any web browser..
I have actually already written this as a windows form app, however I want to port it so that mobile devices and indeed any(not any, but most) online device can view this updating jpeg.
What is the best way to go about this? I dont know javascript but would be willing to give it a try if it is possible in javascript.
Any help is welcome, thanks in advance.
Just so that I am putting smt back, here is the clientside viewer in c#.net which I mentioned above I already made.
namespace clientsideremoteviewer
{
public partial class Form1 : Form
{
string[] dirs = null;
int count = 0;
string savepath;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image = System.Drawing.Image.FromFile("C:" + "\\" + "test.jpg");
timer1.Enabled = true;
timer1.Start();
FolderBrowserDialog folderDialog = new FolderBrowserDialog();
if (folderDialog.ShowDialog() == DialogResult.OK)
{
savepath = folderDialog.SelectedPath;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
pictureBox1.Image.Dispose();
FtpWebRequest reqFTP;
try
{
FileStream outputStream = new FileStream(savepath + "\\" + "frame" + count + ".jpg", FileMode.Create);
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new
Uri("ftp://www.thestorythusfar.co.uk/public_ftp/test.jpg"));
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(username, password);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();
long cl = response.ContentLength;
int bufferSize = 2048;
int readCount;
byte[] buffer = new byte[bufferSize];
readCount = ftpStream.Read(buffer, 0, bufferSize);
while (readCount > 0)
{
outputStream.Write(buffer, 0, readCount);
readCount = ftpStream.Read(buffer, 0, bufferSize);
}
ftpStream.Close();
outputStream.Close();
response.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
pictureBox1.Image = System.Drawing.Image.FromFile(savepath + "\\" + "frame" + count + ".jpg");
count++;
}
}