Hello,
I've been tasked with developing a lightweight ftp client for use in
web servers. Obviously, there is no need to redesign the wheel, and
I've basically just been wrapping a class around the ftp library
functions in the php library. Now, this class works great for most
purposes, however, when it encounters a flaky ftp server, I can get
disconnected without warning.
So basically, what is the best way to handle disconnects? I want to
auto-reconnect to an ftp, I think that is the most sensible
solution(if anyone has a better one, please let me know). Is there
anyway to register a callback function that is called when
disconnected from an ftp? If not, is there anyway to poll the status
of the current ftp connection? Possibly I should just have a loop
that sleeps, calls ftp_nlist(), if that fails then it attempts to
reconnect. Then I could just spawn an ftp_client thread that
continuously monitors the ftp connection until killed. Seems like
overkill to me though.. I dunno, anyone have any better ideas?
Sincerely,
Joshua Litt
I've been tasked with developing a lightweight ftp client for use in
web servers. Obviously, there is no need to redesign the wheel, and
I've basically just been wrapping a class around the ftp library
functions in the php library. Now, this class works great for most
purposes, however, when it encounters a flaky ftp server, I can get
disconnected without warning.
So basically, what is the best way to handle disconnects? I want to
auto-reconnect to an ftp, I think that is the most sensible
solution(if anyone has a better one, please let me know). Is there
anyway to register a callback function that is called when
disconnected from an ftp? If not, is there anyway to poll the status
of the current ftp connection? Possibly I should just have a loop
that sleeps, calls ftp_nlist(), if that fails then it attempts to
reconnect. Then I could just spawn an ftp_client thread that
continuously monitors the ftp connection until killed. Seems like
overkill to me though.. I dunno, anyone have any better ideas?
Sincerely,
Joshua Litt
Comment