How could I build a ftp server by Qt5?
-
As the title mentioned, I would like to build a ftp server which listen to ip camera(send stream by ftp protocol), I have found that QNetworkAccessManager can download the data from ftp protocol, but cannot find any data mention about how to create a ftp server by Qt5, old QFtp or curl, all of them only show you how to create a ftp client.
The simplest solution I can come up is download the stream from the ip camera periodic, is this the right thing to do? Thanks
-
Qt has noting for specifically to ftp & not required as well.
You need to write your own server using the Sockets. I'm not very sure why you would like to develop your own server. There are so many open source server already there and they will do the job for you. You need to only write a client. You may get a openSource C++ ftp client as well. Just you can integrate the same. -
@dheerendra said in How could I build a ftp server by Qt5?:
I'm not very sure why you would like to develop your own server. There are so many open source server already there and they will do the job for you.
Do you mean open source server like FileZilla? Or there exist open source c++ ftp server library worth to recommend?
Have suggested them to use open source software like FileZilla, problems are
- QFileSystemWatcher do not guarantee it can "capture" every files change in the directory
- There is no way to check the file is written complete except of polling
- They want simple ui
- Extra benefits, process the frame directly without writing/reading them to harddisk is more efficient
1, 2 could be solved if I scan the folder periodic and keep the record, although this solution do not sound efficient.
@dheerendra said in How could I build a ftp server by Qt5?:
You need to only write a client
Do you mean download the stream from the ip camera periodic?
-
Yes, I'm talking about the software like FileZill or winSCp or something. I have not used any.
Just curious. Do you want take the frames from IPCamera and display it ? If that is the case why FTP server required ? Camera vendor should be providing the way to fetch the frames and give the frames.
-
@dheerendra said in How could I build a ftp server by Qt5?:
Just curious. Do you want take the frames from IPCamera and display it ?
Yes
@dheerendra said in How could I build a ftp server by Qt5?:
If that is the case why FTP server required ? Camera vendor should be providing the way to fetch the frames and give the frames.
This is the first time I try to capture the frame IP camera which transfer frame by ftp protocol, so I am not sure which solution is the right one to pick. The reason I want to create a ftp server is because I think the ftp server do not need to download the frame by setting the duration manually, it listen to the client and download the frame when there are new one, maybe this would less likely to missed frames(I could be wrong).
Would try with QNetworkAccessManager to download the frames first, if not work, find another way, I like simple solution.
-
Your interest is that whenever camera uploads the file to ftp server, you would like to download to your app. If that is the case, you must have ftp server communicating to you. I'm not aware of any ftp server doing this. For this you must have filewatcher at your server and which indicates that new file has come.
Another option could be setup the web server itself as ftp server and look for RSS feeds from web-server.
-
@tham did you put your own ftp server or web server ?
-
- I found a ftp server developed by Qt on github, would use it for the project first.
- There are another critical tasks on queue right now, this good to have feature need to wait until the other tasks are done
-
About this project, I use the lib found on the github as I mentioned before. It works well and quite easy to adjust the codes for my own requirements.
One bug I found about this lib is it do not delete the resource if clients disconnected(maybe not a big issue for the author so he did not fix it), you need to handle that part by yourself. If you need to have multiple keys, I suggest boost::multiindex, although the api is a bit complicated, it is easy to use and help us write clean codes.
If my customers allowed, I would put the version after alternate to github.