B4J Question B4J: FTP.List >> FTPEntry >> no time

Hello everyone,
have been looking for a solution to a simple matter for hours. The German community cannot help me. It's about Files () which should return the modification time as FTPEntry. Of course triggered by FTP.List etc. Date works. Files (). TimeStamp (see end of line 10) simply does not contain any time. This is always 00:00:00. In the same constellation with other FTP clients, the modification time of the files is displayed correctly.

Is there a trick? Is this known and is there a workaround? Can I somehow event. switch between creation time and modification time?

I'm grateful for every tip. Without this time information, my project under B4J will die.

Walter Siekmann

FTP_ListCompleted in B4J:
Sub ftp1_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
    If Success = False Then
        Log(LastException)
    Else
        For i = 0 To Folders.Length - 1
            Log("Dir: " & Folders(i).Name)
        Next

        For i = 0 To Files.Length - 1
            Log("File1: " & ServerPath & "/" & Files(i).Name & ", " & Files(i).Size & ", " & DateTime.date(Files(i).Timestamp) & " " &  DateTime.time(Files(i).Timestamp))
        Next
    End If
End Sub
 
Hello Erel,
You are absolutely right in your assertion. I've already had this experience. If not that extreme.
I had now tried out the JNet library with FTP on the following FTP servers.
-FileZilla servers
-The Personal FTP-Server (Here I couldn't access my subfolders in my main folder because of a rights error. >> I also never had it!)
-Cerberus FTP server
I don't get a time for any of them.
From experience with other programming languages in connection with FTP clients / servers, I can say that at least the modification date always worked with the FTP server "Personal FTP Server".
The Apache Net library has to be very, very picky about working with FTP servers. Is there any empirical value with which FTP servers the library works with?
My target FTP servers for the project are around 40 FTP servers in ABB robots. I have not been able to test this yet because the project has not made progress. But from experience I can tell if it is with
the "personal FTP server" then also works with the ABB robots.
For me this problem is just a bug. I'll see if I can still find solutions. Otherwise the topic of B4J and Java died for me. Don't get me wrong, B4X is a great thing.
Quick to learn, quick to program, nice IDE. But the Bugi libraries break everything.

See jFileWatcher library: I discovered a design flaw here yesterday. But I will still contact the programmer if I still think it's necessary.

Greeting
Walter Siekmann
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
jFileWatcher is not relevant here.

Sorry, I misread the first post. I thought that f.TimeStamp itself is 0.
You can see what the server returns with this code:
B4X:
ftp.List("/")
Wait For ftp_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
For Each f As FTPEntry In Files
    Dim jo As JavaObject = f
    Log(jo.RunMethod("getRawListing", Null))
    Log(DateTime.Time(f.Timestamp))
Next
On my Linux FTP server, the time component is missing on older files. This is what the server returns (it uses 'ls' internally).

If the raw list does contain the time and f.Timestamp doesn't then you can parse it yourself. Shouldn't be too difficult.
 
Upvote 0
Sorry Erel,
maybe some information got lost through translating. I write in German and translate with Google Translator.
Thanks for the test program. During execution I got the correct date again but the time 00:00:00. It was then clear to me that it had something to do with the files, but it is not due to the files that are from the ABB robots.
There are also some files for example. .pdf's affected. When first listing after copying it to the FTP server, B4J always shows me the time 00:00:00. WIN7/external FTP-Client shows the correct time. If I then edit and save the file on the FTP server and thus a new time stamp is generated,
then B4J shows the correct change time. That is strange behavior! I'm currently working on my work computer at work. He still has WIN7/Filezilla. When I'm at home I'll look at it again under WIN10/Cerberus.
Thanks for your help. Now I can build on this information and solve the problem.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Note that writing:

1. Quick to learn, quick to program, nice IDE. But the Bugi libraries break everything.
2. I'm grateful for every tip. Without this time information, my project under B4J will die.
3. For me this problem is just a bug. I'll see if I can still find solutions. Otherwise the topic of B4J and Java died for me.

Is not the correct way to ask for support. Especially when it turns out that there is no bug at all...
 
Upvote 0
Who says there is no mistake? You misunderstood me.
Of course, if you think if Java doesn't show time to first change a file, then that's correct. But all the other libraries have no problem with it and show the time. All FTP clients show the time and
the operating system under the FTP server shows 3 times for the files. And then that's wrong. Then I'll agree with you, then Java won't have a bug in the library.
I can live with the mistake now because I know what to do about it. If the next one comes across it then they will just ask again.

To 2: What's so wrong with that. Is a 100% statement. I've done this several times. If a programming language does not provide what I need, then the cooperation is ended.

I always prefer not to ask anyone because almost everyone feels offended by any statements. In the future I will reduce the inquiries to zero so as not to disturb you.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Who says there is no mistake? You misunderstood me.
Of course, if you think if Java doesn't show time to first change a file, then that's correct. But all the other libraries have no problem with it and show the time. All FTP clients show the time and
the operating system under the FTP server shows 3 times for the files. And then that's wrong. Then I'll agree with you, then Java won't have a bug in the library.
I can live with the mistake now because I know what to do about it. If the next one comes across it then they will just ask again.
It is B4J, not Java. The FTP client shows you whatever returned from the server.

Questions are good, just no need to add the "drama" around them.
 
Upvote 0
Top