Reviewing my first file transfer using Asio
Hi everyone, I was learning Boost.Asio recently and to learn by doing a project, I decided to write a simple file transfer. So I wrote an *Async TCP Server* and a *Sync TCP Client; *you can use a client to send any kind of file to the server. This is how it works: 1) Clients connect to the server. 2) Clients send the file name to the server. 3) If everything is okay, the server will return an "OK" to that client and wait for that client to send the file. 4) If the client received "OK", it'll send the file. 5) If everything goes well, the file is received by server and the connection will be closed. I will attach the source codes in this email. So here are my questions: 1) Would you mind please review my code and say the problems? I'm a newbie in Asio ;) 2) How to make my client and server talk with a special protocol? Let's say HTTP. (If a socket server understands HTTP, will it be a web server? something like Nginx and Apache.) 3) What is the next step? How can I improve this? What should I learn/do next? Anything is kindly appreciated :) With best regards, Farbod
Happy to have a look. Is this intended for use on Windows, Linux or both? On Tue, 1 Jun 2021 at 15:35, Farbod Ahmadian via Boost < boost@lists.boost.org> wrote:
Hi everyone, I was learning Boost.Asio recently and to learn by doing a project, I decided to write a simple file transfer. So I wrote an *Async TCP Server* and a *Sync TCP Client; *you can use a client to send any kind of file to the server. This is how it works: 1) Clients connect to the server. 2) Clients send the file name to the server. 3) If everything is okay, the server will return an "OK" to that client and wait for that client to send the file. 4) If the client received "OK", it'll send the file. 5) If everything goes well, the file is received by server and the connection will be closed. I will attach the source codes in this email. So here are my questions:
1) Would you mind please review my code and say the problems? I'm a newbie in Asio ;)
2) How to make my client and server talk with a special protocol? Let's say HTTP. (If a socket server understands HTTP, will it be a web server? something like Nginx and Apache.)
3) What is the next step? How can I improve this? What should I learn/do next? Anything is kindly appreciated :)
With best regards, Farbod
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thanks for your reply, Well I'm testing it on my Linux (A Fedora 34 ;)) and for now, Windows is not the case. On Tue, Jun 1, 2021 at 8:04 PM Richard Hodges via Boost < boost@lists.boost.org> wrote:
Happy to have a look.
Is this intended for use on Windows, Linux or both?
On Tue, 1 Jun 2021 at 15:35, Farbod Ahmadian via Boost < boost@lists.boost.org> wrote:
Hi everyone, I was learning Boost.Asio recently and to learn by doing a project, I decided to write a simple file transfer. So I wrote an *Async TCP Server* and a *Sync TCP Client; *you can use a client to send any kind of file to the server. This is how it works: 1) Clients connect to the server. 2) Clients send the file name to the server. 3) If everything is okay, the server will return an "OK" to that client and wait for that client to send the file. 4) If the client received "OK", it'll send the file. 5) If everything goes well, the file is received by server and the connection will be closed. I will attach the source codes in this email. So here are my questions:
1) Would you mind please review my code and say the problems? I'm a newbie in Asio ;)
2) How to make my client and server talk with a special protocol? Let's say HTTP. (If a socket server understands HTTP, will it be a web server? something like Nginx and Apache.)
3) What is the next step? How can I improve this? What should I learn/do next? Anything is kindly appreciated :)
With best regards, Farbod
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Farbod Ahmadian
-
Richard Hodges