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++;
         
        }

}

If you have access to the server, and it's on a IIS.
You can create a webservice with a property that provides the image as a byte array on request.
That way, you can downsize the amount of coding required in the client and leave it up to each developer of mobile apps on how to handle image presentations.
And it would not require a logon to the ftp-server.

If you want to make it cross-platform compatible I suggest you drop C# and look at Javascript and AJAX as they can update your pages in real time. The problem with this is that you need a server somewhere that you can host HTML pages on.

If that isn't a problem though then you should be sorted :)

(If you want to stick to C# then you should take a look at the Compact Framework and use the built in VS Emulator for embedded devices)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.