shobhit6993 / P2P-chat-application

A simple P2P chat in Linux.
10 stars 3 forks source link

Sorry to be kindof a newbie but isn't this meant to be p2p so why is there a server. #1

Open ghost opened 4 years ago

kloontim commented 4 years ago

I an also not exactly an expert on this topic and this is not my work but I would guess this repo was more of a fun afternoon/learning project. The method, which is used here to communicate between client and server, is really basic and not typical for normal stuff like text. Plus the higher level protocols provide efficiency and security way more easily if not even as a standard measure. Further I would agree that p2p in it's formal definition is not present at all if I remember the code correctly. The only way you can call this even remotely peer to peer is if your peer would host the server.

So if you were locking for a reference or a solid tool for p2p communication I would recommend searching further. But if you are looking for a few examples how to work with the TCP protocol, like I did for my little experiments, this might be worth a look.

ghost commented 4 years ago

I'm trying to just have a very simple command line chatting p2p but I've tried before with javascript and that was very difficult but now I'm trying to use c++. Do you know any good tutorials for p2p with c++ or javascript even.

kloontim commented 4 years ago

Sadly No. But if you could not find anything good at Stack overflow, YouTube ore anywhere else, you may reconsider if you really want the p2p aspect. To me it sounded a lot easier than it is, you need at first something to connect to, which will probably IP-adresses which will probably change fairly regular if you use IP-V4. Than the firewall has to let you through, which probably has to be done manually and come with security issues or you need far more knowledge about networking than I have. If you would allow a server in the mix the two described problems are more or less solved.

shobhit6993 commented 4 years ago

Hey @jamesgames69 and @kloontim! Thanks for your interest in the project. I did this many years ago so it is hard to remember the details but a skimming through the code, it seems the server is there to hold the list of online clients. Any new client that joins the "chat room" gets the list of IPs of other clients from the server, and then the client can pick one of the other online clients to talk to in a p2p fashion without going through the server.

Hope this helps.