Register and join over 40,000 other developers!
Recent Topics
-
The Game You Are Waiting For?
WendellHarper - Dec 06 2020 01:21 PM
-
Quora and Reddit Backlinks
WendellHarper - Dec 06 2020 01:14 PM
-
Delete account
pindo - Jul 23 2020 01:33 AM
-
Print specific values from dictionary with a specific key name
Siten0308 - Jun 20 2019 01:43 PM
-
Learn algorithms and programming concepts
johnnylo - Apr 23 2019 07:49 AM
Recent Blog Entries
Recent Status Updates
Popular Tags
- networking
- Managed C++
- stream
- console
- database
- authentication
- Visual Basic 4 / 5 / 6
- session
- Connection
- asp.net
- import
- syntax
- hardware
- html5
- array
- mysql
- java
- php
- c++
- string
- C#
- html
- loop
- timer
- jquery
- ajax
- javascript
- programming
- android
- css
- assembly
- c
- form
- vb.net
- xml
- linked list
- login
- encryption
- pseudocode
- calculator
- sql
- python
- setup
- help
- game
- combobox
- binary
- hello world
- grid
- innerHTML

6 replies to this topic
#1
Posted 04 February 2009 - 11:37 AM
Hello,
I have been asked to try to program a ftp file stream in python. Here's the complete story:
There's a FTP server with a comma seperated file (csv) on it. A device writes log information in to the csv file whenever something log-worthy occures. This csv file is around 22 MB and keeps on growing. I want to read the latest csv entry that's gotten in to the file. So my question is:
Is it possible to connect to the FTP server, open up a stream to the csv file and retrieve the latest data? I have to able to get a constant stream and always get the latest csv entry.
If this is possible wont there be a conflict when the device is writing to the .csv file and i'm reading from it?
If this isn't possible in python, do you have any idea if it is in another programming language?
Hope i explained everything well enough.
Thanks in advance.
I have been asked to try to program a ftp file stream in python. Here's the complete story:
There's a FTP server with a comma seperated file (csv) on it. A device writes log information in to the csv file whenever something log-worthy occures. This csv file is around 22 MB and keeps on growing. I want to read the latest csv entry that's gotten in to the file. So my question is:
Is it possible to connect to the FTP server, open up a stream to the csv file and retrieve the latest data? I have to able to get a constant stream and always get the latest csv entry.
If this is possible wont there be a conflict when the device is writing to the .csv file and i'm reading from it?
If this isn't possible in python, do you have any idea if it is in another programming language?
Hope i explained everything well enough.
Thanks in advance.
#2
Posted 04 February 2009 - 11:52 AM
Wait are you saying you want to Read a file thats not yours?
Do you have any reason for looking at the file?
Or do you own the computer that contains the file
Do you have any reason for looking at the file?
Or do you own the computer that contains the file
#3
Posted 04 February 2009 - 01:21 PM
Wait are you saying you want to Read a file thats not yours?
Do you have any reason for looking at the file?
Or do you own the computer that contains the file
Thx for your reply.
It's an FTP server where the file is stored with authorisation (of course), i got the username and pass to make a ftp connection.
Let me explain again:
Say you have a device somewhere in a network that logs every handling it does in a file. That file is downloadable by using FTP. I have to check if something odd happens to the device by checking the log file. If i would download the entire log file everytime to check if something has happened my process will be slow and inefficient because the log file is big. So if possible i would want to open a stream to the file and get the latest log information. But i dont know if it's possible in python...i hope so.
#4
Posted 04 February 2009 - 01:26 PM
Oh...Well would it be possible for the file you need to see have set dates on it everytime it logs something you like a date stamp then you can just recall the date and it will only give you that part...If its something like that then you should be able to do something like with python but as the thing says i'm a newbie and have only been learning for the past few months
#5
Posted 08 February 2009 - 06:50 AM
The csv file has dates in it, every csv entry starts with a date and then some log info. You have any idea how i will get only a specific part out of the file in python?Oh...Well would it be possible for the file you need to see have set dates on it everytime it logs something you like a date stamp then you can just recall the date and it will only give you that part...If its something like that then you should be able to do something like with python but as the thing says i'm a newbie and have only been learning for the past few months
#6
Posted 08 February 2009 - 07:18 AM
The FTP protocol does not support resuming a file transfer from a set position. It supports RESTART, but it'll only work within the same session as the initial download. There may be some extension I don't know about.
#7
Posted 04 January 2013 - 09:33 AM
I handle ftp work for my employer as a major part of my job and I can tell you that what you want to do isn't defined in the ftp protocol and therefore can't be done. There are two ways to do what you want that I can see.
Option 1 is to pull the entire file down and use the 'tail' utility (converted from Unix to Windows) to pull the last line of the file. Depending on how often you want to do this and how fast your connection is this is probably going to be very, very painful.
Option 2 would be to install the 'tail' utility on the server and set it up to pull the last line as a scheduled job (every day, every hour, every 15 minutes, etc.) and send the output to a temporary file. Your ftp job could then connect a minute or two later, pull that temporary file and delete it after you have a copy.
I'd vote for Option 2 as the 'tail' command will operate in seconds and the ftp connection/pull/delete operation will likely be less than a minute.
If you have any other questions feel free to ask - as I said I've been doing ftp work x10+ years and in fact was tasked with writing an ftp scripting language and ftp engine which is in use company-wide.
Option 1 is to pull the entire file down and use the 'tail' utility (converted from Unix to Windows) to pull the last line of the file. Depending on how often you want to do this and how fast your connection is this is probably going to be very, very painful.
Option 2 would be to install the 'tail' utility on the server and set it up to pull the last line as a scheduled job (every day, every hour, every 15 minutes, etc.) and send the output to a temporary file. Your ftp job could then connect a minute or two later, pull that temporary file and delete it after you have a copy.
I'd vote for Option 2 as the 'tail' command will operate in seconds and the ftp connection/pull/delete operation will likely be less than a minute.
If you have any other questions feel free to ask - as I said I've been doing ftp work x10+ years and in fact was tasked with writing an ftp scripting language and ftp engine which is in use company-wide.
Also tagged with one or more of these keywords: stream
Language Forums →
PHP →
Save JPG image every second - but avoid saving damaged/corrupt images comprised of multiple images?Started by elliottveares, 24 Nov 2015 ![]() |
|
![]() |
||
Language Forums →
C# →
(C#) How to capture video stream without using a third party SDKStarted by BaumHard920, 17 Nov 2014 ![]() |
|
![]() |
||
Language Forums →
C and C++ →
QDataStream: Open QString Values in geditStarted by untitled_1, 16 Feb 2013 ![]() |
|
![]() |
||
General Forums →
General Programming →
Continuous streaming to audio clips.Started by Roman Y, 12 Dec 2012 ![]() |
|
![]() |
||
General Forums →
Everything Else →
Request Services →
Reading Id3 Tags from A SHOUTcast mp3 Radio Stream with PHPStarted by HasanKeyf, 01 Nov 2012 ![]() |
|
![]() |
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download