C++ file sharing libraries?

Oct 22, 2012 at 6:42pm
I want to create a very simple program that lets 2 people share files over the internet by just putting the file in a folder and it automatically syncs it to the other persons. I know there are programs out there like this but i want to try to make my own. I'm getting a lot better with c++ and its time to take it to the next level, so is there any easy to use libraries out there that will help me with this? also is there anything else i will need to do for this to work?
Oct 22, 2012 at 7:02pm
You will need a "presence" server, where two (or more) users can login (with a password or without) and can "see" each other.

You can design using two models
1) The shared file is stored on server first and then server pushes he file to the other user

2) Presence server gives the (client of) first user the IP of the other user and then the client sends the file to the other side (IMs follow this for sending file)

In both cases you also need to develop application level protocol, and the presence server. Without presence one the users wont be able to "see" each other and hence wont be able to share file with.

As for libraries go look at boost.asio and poco
Oct 22, 2012 at 7:03pm
You can do it without libraries, all you need to do is establish a connection then check the files and save the files to everyone on the network.
Oct 22, 2012 at 7:09pm
How will the program who all are on the network? Also, there should be some program "listening" for files.
When two programs talk to each other over network one program should typically know the name/IP of other machine, then there is a handshake to check whether the program has established connection with right program on other side etc.

Otherwise how do you "save the files to everyone in the network"?
Oct 22, 2012 at 7:22pm
I dont know codewalker thats what im asking. or are you asking too.
Oct 22, 2012 at 7:41pm
so what would i need to do to accomplish this? like, what sites can teach me the code i need to do this ?
Oct 22, 2012 at 7:58pm
Like codewalker mentioned you will need a server that acts as an intermediary for the clients and either creates the peer connection or provides the info for the clients to create it. This search has some interesting links http://www.google.com/search?q=client+server+c%2B%2B&rlz=1C1GGGE_enUS436US488&aq=0&oq=client+server+c%2B%2B&sugexp=chrome,mod=0&sourceid=chrome&ie=UTF-8
Last edited on Oct 22, 2012 at 7:59pm
Oct 22, 2012 at 8:01pm
I am telling, that question was more for Pickle.
You need all of the things that I said. Libraries will help with sockets and sending/receiving data.

The design you have to decide, and then develop a application level protocol yourself. By doing this will you will learn about network programming and protocols . Otherwise use already existing protocols like XMPP which google uses. this might prove to be too much depending on how much one knows about network programming.

If you want some comprehensive protocol to be developed and looking at helper libraries you can also have a look at protocol buffers
Oct 22, 2012 at 8:14pm
I want to do this the easiest way possible.
Oct 22, 2012 at 8:18pm
start by creating two simple programs 1) that listens on a port, accepts a connection receives a file and saves it 2) that opens a connection to that port (initially it can be same machine as program 1) then opens and sends a file across socket

Later on you can add handshake and error handling etc.
Topic archived. No new replies allowed.