Home Forums .NET libraries Xceed SFTP/FTP for .NET GetDownloadStream question

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #21158 |


     I’ve gotten an asigment at my work where im dealing with the following problem:

    Theres a medical device that has its own ftp server. It logs everything it does in a file

    , with a timestamp. Sometimes an error occures and it writes what type of

    error in the log file. I have to try to read the error right when it happens and report it.

    FTP’ing the entire log file and analyze it everytime takes way to much time. I’ve read the documentation of

    the method GetDownloadstream but i want to know some more about it and want to know if 

    its suited for my demands. Can Getdownloadstream get me a constant stream to the log file

    of the medical device? And if the device is writing new information to the log file will i receive

    it directly from the stream? Does it matter if the stream is open and the device wants to write data to it

    (wont there be a tcp conflict?).


    Thanks in advance.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by iris (had 2537 views)

    User (Old forums)
    Post count: 23064

    The solution we see is to use the GetDownloadStream overload that takes an offset.  Use the offset to specify to the server you want to start receiving the file from the place you stopped reading it the previous time.  Once you have received the remaining of the file, add the number of bytes you just read to the offset you had.  This will be your new offset for the next time you open the stream.

    Now, the stream will remain in a receiving state until you close it.  So you will need to test to see if you can keep the stream open while the medical device tries to write to the file, that it succeed in doing so, and that you receive the resulting bytes,  If so, you will still want to keep the offset of where you are, in case you get disconnected, so you can reconnect and start from where you were.  If not, then you’ll have to close the stream to let the device write to the file, and open the stream again.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by André (had 2929 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.