sametime - Reading A File While It is writed by another process -


I have an application that uses the C: // root folder. Pictures in this folder are pictures by these pictures are taught by

  1. Images are coming from a Linux machine via FTP, a Linux machine is in Windows which is used to open the C: // root of FTP Uses. IMAGE_1.jpg Save
  2. IMAGE_1.jpg To show in the picture box, the C # windows form is read by the app.

    Images are coming every 10 seconds from a Linux machine Windows shows these images in a thread

    Occasionally, Linux or Windows skips the exception. Because one of them has tried to show the image to show (windows), trying to save the other image (Linux)

    Therefore, I have to understand that, if Image_1.jpg Do not try to show the image in win form, used by Linux machine.

    In your Win form application, open the file to read, and Share the file with other processes so that they can read / write the file.

    Use to do this.

    If you use the bus or the file will not be shared.

    By sharing, you should keep the FTP side of things happy.

    If you get an exception while trying to open a file in Windows - it's okay. Just grab the exception and try again soon.

    When you successfully open a file, check that the last two bytes are FF D9. In this case your JPG has been uploaded.

    Here's some pseudo code. By using success = false (filestream fs = file.open (path, // image1.jpg FileMode.Open, FileAccess.Read, // We just need to read the fileshare.) Redread )) / Important to share! {// If the last two bytes are FF D9 // success = true ... can display the image now) if (! Success) {// file is being uploaded, or some other problem happened / later Try again}

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

jsp - Google line chart x-axis shrinks on transition -

java - Reaching JTextField in a DocumentListener -