LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-02-2013, 10:03 AM   #1
pls_help_URGENT
Member
 
Registered: Aug 2012
Posts: 42

Rep: Reputation: Disabled
Question Peer to Peer file transfer software


I looked up this: http://www.prohackingtricks.com/2011...-p2p-file.html

I am _not_ well versed in networking.
I want to make this software as a hobby project.
  • Besides knowing about the work flow of this kind of software, what __networking concepts__ do I need to know before attempting to start coding?
  • Is _multithreading_ involved in this software somehow?

Platform will be Linux currently.

I only intend to build this for searching files in shared folders on other computers, _not_ for downloading anything from internet.

Please guide.

Last edited by pls_help_URGENT; 05-09-2013 at 06:29 PM. Reason: title edit
 
Old 05-02-2013, 10:25 AM   #2
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,752

Rep: Reputation: 189Reputation: 189
Your wanting a bittorent client for Linux?
There are many.
Transmission works well, so do others.
Look and see what's in your distributions repository.

http://www.foresightlinux.se/the-bes...nts-for-linux/
 
Old 05-03-2013, 12:31 AM   #3
pls_help_URGENT
Member
 
Registered: Aug 2012
Posts: 42

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by teckk View Post
Your wanting a bittorent client for Linux?
No, I don't want a bittorent client.
I want to "build" a bittorent client.

Please read the question again.
 
Old 05-06-2013, 11:24 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
If your system is intended to use network shares, then you don't need to know anything about networking, except how to configure the shared filesystems. In Linux, network filesytem support is normally NFS, or Samba (SMB/CIFS) if windows hosts are invloved. Once the filesystem shares are mounted, your code simply sees the shared files as if they are local to the filesystem. This is nothing at all like what bittorent is or does. From a software perspective, network communication on a local LAN vs a WAN (the Internet) is all the same.

Your specifications and the examples cited in your link have wildly differing approaches and purposes, so I'd be prepared to cut teckk a bit of slack about that. Please re-think and re-phrase your objectives, as the question you posed is full of contradiction.

You say you want to "build" a bittorent client. To most of the seasoned Linux users, that means you want to take an existing source tarball, and use a compiler and other tools to turn it into executable runtime object code. Is that what you really mean? Or by "build" do you really mean "write" a bittorent client. If so, then you definitely need to do some learning about networking concepts; probably quite a lot. Multithreading might be useful, but not a necessary part of your project.

By the way you've posed your question, I sense that you've done very little programming, and on that basis, I'd suggest that you've probably under-estimated the scope of your proposed project.
--- rod.
 
1 members found this post helpful.
Old 05-07-2013, 01:39 AM   #5
pls_help_URGENT
Member
 
Registered: Aug 2012
Posts: 42

Original Poster
Rep: Reputation: Disabled
Firstly here's a thanks for the constructive reply.

Quote:
Originally Posted by theNbomr View Post
If your system is intended to use network shares, then you don't need to know anything about networking, except how to configure the shared filesystems. In Linux, network filesytem support is normally NFS, or Samba (SMB/CIFS) if windows hosts are invloved. Once the filesystem shares are mounted, your code simply sees the shared files as if they are local to the filesystem. This is nothing at all like what bittorent is or does. From a software perspective, network communication on a local LAN vs a WAN (the Internet) is all the same.
I thought (wrongly) that those functionalities are similar with the only
difference being that bittorrent downloads from the internet and the other
software would download it from other computer on the LAN.

Quote:
Originally Posted by theNbomr View Post
Please re-think and re-phrase your objectives, as the question you posed is full of contradiction.
Well, the only real objective I have is learning networking concepts in
a practical, programmatic, and interesting way. It is true that I have very
little programming experience, that is the reason for this hobby project.

Quote:
Originally Posted by theNbomr View Post
Or by "build" do you really mean "write" a bittorrent client. If so, then you definitely need to do some learning about networking concepts; probably quite a lot. Multithreading might be useful, but not a necessary part of your project.
By "build" I did mean "write".

- What networking concepts would you suggest for the start of this project?
- How should I start to get a minimal functionality working w.r.t bittorrent client?



***********************

Last edited by pls_help_URGENT; 05-07-2013 at 01:44 AM.
 
Old 05-07-2013, 04:55 AM   #6
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
You're going to need to bookmark & read http://beej.us/guide/bgnet/
 
1 members found this post helpful.
Old 05-07-2013, 10:47 AM   #7
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
chrism01 beat me to the usual recommendation of Beej's Guide, which is a very good introductory resource. It will introduce you to the fundamentals of client/server networking using the traditional Linux sockets API. Virtually all network applications in Linux use this fundamental premise. Looking at the bigger picture, you will need to locate and study the protocol(s) used by bittorent, which can be built upon the lower level sockets API. It won't hurt to familiarize yourself with some diagnostics tools such as tcpdump, nc (netcat), as well as a few that I think are mentioned in Beej's Guide. You haven't said what programming language you're using, but most of the tutorial information you'll find will assume the C language. In many languages, I speculate that you may find API libraries that can be used to build the basic bittorent application without having to learn much networking detail.
--- rod.
 
1 members found this post helpful.
Old 05-08-2013, 12:00 AM   #8
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
If you want to try at a slightly higher level than C (at least to start), try the Perl modules here http://search.cpan.org/search?query=bittorrent&mode=all
 
1 members found this post helpful.
Old 05-08-2013, 05:28 AM   #9
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,727

Rep: Reputation: 488Reputation: 488Reputation: 488Reputation: 488Reputation: 488
> Software which searches for files in shared folders of LAN connected computers

It is find -- provided you (smb)mounted the folders in question beforehand. See also functions opendir and readdir.
 
2 members found this post helpful.
Old 05-08-2013, 09:34 AM   #10
pls_help_URGENT
Member
 
Registered: Aug 2012
Posts: 42

Original Poster
Rep: Reputation: Disabled
Thanks to all again.

From: http://en.wikipedia.org/wiki/File_sh...r_file_sharing
Quote:
Users can use software that connects in to a peer-to-peer network to search for shared files on the computers of other users (i.e. peers) connected to the network. Files of interest can then be downloaded directly from other users on the network. Typically, large files are broken down into smaller chunks, which may be obtained from multiple peers and then reassembled by the downloader. This is done while the peer is simultaneously uploading the chunks it already has to other peers.
This is what I meant in my OP.
Can this program not be written for computers communicating to each other by LAN?

Is this similar to bittorrent program?
 
Old 05-08-2013, 10:43 AM   #11
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
I think what you are actually trying to accomplish is a file transfer application. This is distinguished from file sharing by the way it is implemented and by the level at which it is implemented. File sharing (aside from the Bittorent/Gnutella/other P2P use of the term) usually implies that a host makes a filesystem tree available for other hosts to access as a filesystem, and independent of any application-level protocols. The OS's do the sharing, and the client host OS exposes the shared filesystem to all applications, which use it as if it was a local filesystem.

File transfer, OTOH, generally implies that two (usually two) peer applications provide a means for a user to copy files between the peer hosts. FTP/SFTP is a common example in this category, and there are numerous others. Various protocols of this flavor proliferated during the era when dial-up modems were common as a means for remote access between hosts. The Peer-To-Peer (P2P) class of file sharing essentially builds on this concept by adding the facility for multiple users/hosts to participate, for peer hosts to search across multiple participating hosts, and for transfers to be done on a many-to-one and many-to-many basis. This does seem to be what your wikipedia link is referring to.

Again I would point out that networking application software doesn't really distinguish between WAN and LAN scope. The TCP/IP code is the same in either case. Network infrastructure may limit or permit propagation of network traffic, either according to global rules or according to local configuration or both. Application software is generally written without any assumptions about network configuration.

--- rod.
 
1 members found this post helpful.
Old 05-09-2013, 08:15 AM   #12
pls_help_URGENT
Member
 
Registered: Aug 2012
Posts: 42

Original Poster
Rep: Reputation: Disabled
Utterly thankful for your detailed reply.

Questions:
1. Is peer to peer file transfer software more easier to write as compared
to the other one for a start?

2. Will peer to peer file transfer software writing help me in learning
more networking concepts?

3. Can you please point out some good "documented" such softwares for Linux?
When I searched Google with "peer to peer file transfer software linux" all
I could get was: http://apollon.sourceforge.net/
Other results were about file sharing.
 
Old 05-09-2013, 10:28 AM   #13
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Unless you are very accomplished in networking and OS techniques, you would have a very big challenge to write a network filesystem. Writing a one-to-one file transfer program would be easy in comparison. A P2P style application such as bittorent or gnutella would fall somewhere in the middle of the complexity spectrum, but still very challenging for a newbie.

File transfer software writing will definitely help you learn networking concepts. The larger challenges falling out of it will probably be in non-networking aspects, however. The user interface for most applications is one of the biggest hurdles.

For documentation, your best bet is probably to find a specification document for a specific protocol. Wikipedia lists a few, which is a good jumping off point for further research. Start with something simple, such as FTP, which I think is specified fairly rigorously in an RFC. Most such protocols will have distinct client and server components, so it will serve you well to write one side of the protocol, using a working system as the peer counterpart against which to test the component that you are writing. The source code for an implementation of any particular protocol will be a very good source of information, especially if it's target architecture matches your target architecture.

I suggest that it behooves you to write an implementation of an existing protocol, since that will allow you to focus on learning the core networking concepts, rather than the details of a particular protocol. Doing so also gives you the advantage of an abundance of existing implementations against which to test your code. As a newbie project, you probably don't need to start designing new protocols (at this stage, nobody really needs to do that), but learn how to use the network stack, and write to a specification. In closing, I would also add that while a file transfer application is a great starting point for learning about networking software, it will also provide you with a fairly narrow view of the subject, which is quite vast and has many complexities in other uses.

--- rod.
 
2 members found this post helpful.
Old 05-09-2013, 11:14 AM   #14
pls_help_URGENT
Member
 
Registered: Aug 2012
Posts: 42

Original Poster
Rep: Reputation: Disabled
Without your help, I couldn't have gone too far.
Thanks again.

Quote:
Originally Posted by theNbomr View Post
File transfer software writing will definitely help you learn networking concepts. The larger challenges falling out of it will probably be in non-networking aspects, however. The user interface for most applications is one of the biggest hurdles.
Why would UI building be a hurdle? Isn't it all about building a GUI with Qt's
signals and slots etc.?

Quote:
Originally Posted by theNbomr View Post
Writing a one-to-one file transfer program would be easy in comparison.
Quote:
Originally Posted by theNbomr View Post
I suggest that it behooves you to write an implementation of an existing protocol, since that will allow you to focus on learning the core networking concepts, rather than the details of a particular protocol. Doing so also gives you the advantage of an abundance of existing implementations against which to test your code.
So, in a nutshell you mean to say that I should start with the file transfer
software and should implement the FTP protocol for it?

Quote:
Originally Posted by theNbomr View Post
In closing, I would also add that while a file transfer application is a great starting point for learning about networking software, it will also provide you with a fairly narrow view of the subject, which is quite vast and has many complexities in other uses.
The underlined statement is a good or a bad thing?
 
Old 05-09-2013, 02:13 PM   #15
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Baby steps. Start with a simple project, and expand on what you learn. Tackling a complex project without the benefit of prior learning will be a recipe for frustration and failure. I brought up the UI subject as an example of stuff you'll need to do which doesn't contribute to your learning of network programming. There will be other stuff, especially as the scope of your project increases.

I meant that you shouldn't assume that you've mastered all there is to know about networking and creation of networking applications from the creation of one or more file-transfer/file-sharing applications.
--- rod.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot multicast when one of the computers connected to the internet in a LAN ilagnateeg Linux - Networking 1 04-12-2010 01:59 AM
can't see shared folders on fedora 11 from lan sandeep_mahadani Linux - Newbie 1 08-14-2009 12:10 AM
finding the connected computers in lan kaushiksolanki Linux - Networking 2 03-02-2009 12:30 AM
share folders/files on LAN debian/MS computers. ecampii Linux - Networking 2 09-28-2005 08:05 AM
viewing network computers and shared folders dpbatagoda Linux - Newbie 1 12-05-2003 04:08 AM


All times are GMT -5. The time now is 11:47 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration