LinuxQuestions.org
Visit Jeremy's Blog.
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 06-22-2005, 01:23 AM   #1
koodoo
Member
 
Registered: Aug 2004
Location: a small village faraway in the mountains
Distribution: Fedora Core 1, Slackware 10.0 | 2.4.26 | custom 2.6.14.2, Slackware 10.2 | 11.0, Slackware64-13
Posts: 345

Rep: Reputation: 32
Source Code for a simple ftp server and client


Hi,

I am currently studying (myself , ) how to use the Sockets API for client server applications. I was designinig a simple ftp server and got stuck up somewhere. So I would just like to see some sample source code and see how it is actually done.

I googled this but I did not get what I wanted.

Could anyone give me a link to the source code of a simple ftp server and client. I do not want a full featured server/client just one in which the client can say ls, get, put and the server responding to those requests.

Also I must emphasize here that I not asking help in some kind of assignment or homework. I am studying myself the Sockets API and got stuck up while writing the code for the ftp server.
If somebody would like to help I would post the exact point where I was getting stuck.

But I feel that would be going into too much programming details and it would be better for me to figure that out myself by looking at some sample source code.

Thanks in anticipation.

Last edited by koodoo; 06-22-2005 at 01:24 AM.
 
Old 06-22-2005, 01:53 AM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
which language?
 
Old 06-22-2005, 03:24 AM   #3
koodoo
Member
 
Registered: Aug 2004
Location: a small village faraway in the mountains
Distribution: Fedora Core 1, Slackware 10.0 | 2.4.26 | custom 2.6.14.2, Slackware 10.2 | 11.0, Slackware64-13
Posts: 345

Original Poster
Rep: Reputation: 32
Sorry,

So stupid of me. makes me laugh

I am working in C. So code in C would be preferable. however code in C++ should also do fine.

Thanks again.
 
Old 06-22-2005, 11:34 AM   #4
Dave Kelly
Member
 
Registered: Aug 2004
Location: Todd Mission Texas
Distribution: Linspire
Posts: 213

Rep: Reputation: 31
Doesn't 'apache' meet the requriements?
 
Old 06-22-2005, 01:35 PM   #5
koodoo
Member
 
Registered: Aug 2004
Location: a small village faraway in the mountains
Distribution: Fedora Core 1, Slackware 10.0 | 2.4.26 | custom 2.6.14.2, Slackware 10.2 | 11.0, Slackware64-13
Posts: 345

Original Poster
Rep: Reputation: 32
Quote:
Originally posted by Dave Kelly
Doesn't 'apache' meet the requriements?

Sorry, but I didn't quite understand what you were trying to say. I am not looking to configure or set up anything, I am just a student learning how to write a ftp server/client myself in C using the sockets API and I got stuck in between and so was looking for some help.

Thamks again in anticipation.
 
Old 06-22-2005, 02:50 PM   #6
Dave Kelly
Member
 
Registered: Aug 2004
Location: Todd Mission Texas
Distribution: Linspire
Posts: 213

Rep: Reputation: 31
First line of the second paragraph in the manual.
Quote:
DESCRIPTION
apache is the Apache HyperText Transfer Protocol (HTTP) server program.
It may not have any ftp code in it but then again it may and was just a suggestion on a place to start looking.
 
Old 06-22-2005, 03:26 PM   #7
koodoo
Member
 
Registered: Aug 2004
Location: a small village faraway in the mountains
Distribution: Fedora Core 1, Slackware 10.0 | 2.4.26 | custom 2.6.14.2, Slackware 10.2 | 11.0, Slackware64-13
Posts: 345

Original Poster
Rep: Reputation: 32
Hi, sorry that I misunderstood you.I thought you were suggesting me to setup an Apache web server

Now I understand what you were trying to say.
I'll look into the source code of the apache server. Could you give me a link to that ?
Since I am studying client/server programs I think it would be helpfull

Thanks for the help and sorry again for the misunderstanding.
 
Old 06-22-2005, 06:35 PM   #8
Dave Kelly
Member
 
Registered: Aug 2004
Location: Todd Mission Texas
Distribution: Linspire
Posts: 213

Rep: Reputation: 31
A google search for apache.org turned up only 1 hit.

www.apache.org
 
Old 06-22-2005, 06:40 PM   #9
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
I think the apache code is a bit overkill for what you are trying to do.

I haven't found any good examples in the two seconds I tried to look over the web... but the book "TCP/IP Sockets in C - Practical Guide for Programmers" by Donahoo and Calvert is real good on this subject... and pretty cheap (it is a tiny book). It shows a lot of examples in C of clients and servers, and it contains a complete sockets API reference.
 
Old 06-24-2005, 09:05 AM   #10
koodoo
Member
 
Registered: Aug 2004
Location: a small village faraway in the mountains
Distribution: Fedora Core 1, Slackware 10.0 | 2.4.26 | custom 2.6.14.2, Slackware 10.2 | 11.0, Slackware64-13
Posts: 345

Original Poster
Rep: Reputation: 32
Hi, thanks for the help.

Finally figured out what mistake I was making.

Read the example of an echo client/server from :
Addison.Wesley.UNIX.Network.Programming.Volume.1.3rd.Ed.The.Sockets.Networking.API. and it helped me solve the problem.

I also bought the book "TCP/IP Sockets in C - Practical Guide for Programmers" and it seems to be a great reference.

Thanks again for the help.
 
1 members found this post helpful.
Old 11-29-2010, 05:06 AM   #11
feras
LQ Newbie
 
Registered: May 2010
Posts: 1

Rep: Reputation: 0
Smile ftp simple client and server code just to do ls,send and get

Quote:
Originally Posted by koodoo View Post
Hi, thanks for the help.

Finally figured out what mistake I was making.

Read the example of an echo client/server from :
Addison.Wesley.UNIX.Network.Programming.Volume.1.3rd.Ed.The.Sockets.Networking.API. and it helped me solve the problem.

I also bought the book "TCP/IP Sockets in C - Practical Guide for Programmers" and it seems to be a great reference.

Thanks again for the help.
can you help me sending a sample ftp simple client and server code just to do ls,send and get
I didn't found any thing in google and I am new in c .

regards
 
Old 11-29-2010, 08:24 AM   #12
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: Debian lenny, Slackware 12
Posts: 809

Rep: Reputation: 178Reputation: 178
Quote:
Originally Posted by feras View Post
can you help me sending a sample ftp simple client and server code just to do ls,send and get
I didn't found any thing in google and I am new in c .

regards
In the name of the Flying Spaghetti Monster,

Your first step is to become old in C.

I don't know whether there are "simple" ftp clients and servers out there, but if you want to peruse fullblown versions, you can get the source code for a client here and a server here.
 
Old 02-28-2011, 07:57 AM   #13
Raghu97931
LQ Newbie
 
Registered: Feb 2011
Posts: 3

Rep: Reputation: 0
Hi,
I m currently doing program for ftp were client request a file and server respond by sendibg content of a file.
I have did the simple client/server file transfering but I m facing problem with ftp
please help me or give a link for sample code for file tranfer using ftp.

Last edited by Raghu97931; 02-28-2011 at 08:03 AM. Reason: adding more specification
 
Old 02-28-2011, 11:53 AM   #14
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
If I'm not mistaken, the FTP server is usually implemented as a client of the inetd/xinetd daemon. As such, it should not do any socket-level IO, only reading and writing to standard input & standard output. FTP clients seem to be abundant in source code form, but most seem to target Microsoft platforms, so the socket interface is probably different. I don't know for sure, but my hunch is that the relevant RFC(s) probably spell out the minimum requirement for a conforming FTP client or server, and this may make it difficult to locate a dumbed-down version for study.
--- rod.
 
Old 02-28-2011, 04:00 PM   #15
Raghu97931
LQ Newbie
 
Registered: Feb 2011
Posts: 3

Rep: Reputation: 0
Client Server ftp need some help pls

Last edited by Raghu97931; 03-02-2011 at 02:16 AM.
 
  


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
simple backup process using server/client technology debloxie Linux - Networking 11 10-24-2005 03:58 PM
source code for a php3 server mrobertson Programming 1 06-24-2005 10:49 AM
simple ftp server with gui? NonSumPisces Linux - Software 2 07-29-2004 06:41 PM
Simple Tutorial for compiling source code? SoliTear Linux - Newbie 17 03-15-2004 09:39 AM
simple ftp server question BrianK Linux - General 3 07-31-2002 08:08 AM


All times are GMT -5. The time now is 04:44 AM.

Main Menu
Advertisement
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