Skip to content

Implement of MiniFTP server with knowledge of Unix network programming.

License

Notifications You must be signed in to change notification settings

qinchao0525/MiniFTP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniFTP

Declaration:This project just for learning network programming and use of open source with multi-thread and multi-processing(github).
NOTE:You need Linux to run this Pro.

1. Function and Introduction:

My blog: http://blog.csdn.net/qq_36196684

Implement of MiniFTP server(Have not finished yet).

1.1 Introduction

FTP(File Transfer Protocal), working in appliction-layer of TCP/IP whose transfer-layer is using TCP.
FTP is based on C/S model.
see more about ftp protocol:https://www.ietf.org/rfc/rfc959.txt

1.2 File Type

FTP have four file type:

  • ASCII file: basic file of FTP
    Formed by ASCII chars. Each char have 7bit, and high bit is 0.
  • EBCDIC file:
  • Image file: binary file
    High bit is 0/1.
  • Local file:

differece between ASCII file and Binary file:
windows:\r\n Linux:\n mac:\r

  • Transfer with ASCII:
    windows->linux: \r\n->\n
    linux->windows: \n->\r\n
  • Transfer with Binary:
    Without any change, keeping.

1.3 File struct

  • File struct:
    where there is no internal structure and the file is considered to be a continuous sequence of data bytes
  • record struct: where the file is made up of sequential records
  • page struct: where the file is made up of independent indexed pages.

1.4 Transfer model

  • STREAM Model
    The data is transmitted as a stream of bytes. There is no restriction on the representation type used; record structures are allowed.
  • BLOCK Model
    The file is transmitted as a series of data blocks preceded by one or more header bytes.

1.5 The basic FTP model

image


P1. FTP basic struct model

1.6 working model

  • active model
    client->server
  • passive model
    server->client

2. Project Requirements

2.1 command

2.2 configure

2.3 leisure disconnect

2.4 rate limit

2.5 limit connect

2.6 breakpoint reconnect

3. system struct

3.1 sys logic struct

image
P2. The system struct.
In this model, new subprocess will be created when a client requirement is recevied.
Every single c/s connection has two sub process, one is for sevice and another is for
command between service and client processing.

3.1 submodel

This is the summodel, we implement the function int the model.
submodel
P3. summodel

3.2 string function

3.3 configuration

3.4 FTP cmd map

3.5 process communicate model

3.6 transfer and appe(abord point retransfer)

MiniFTP Written with C++

Implement in windows with c++.

1.Frame of sysmodel

2.Flow chart for C++ programming.

NOTE: reference from http://www.jb51.net/article/96337.htm

3.Connection

Connecting with TCP protocol. Server and client will create a socket by themselves. Server
will wait for connection requirement and decide which client requirement will be accept. Connection
will be made when server and client has suited port and both are free.
Server will continue to wait for connection when client require to break the link, but server only
use the way that one client with one server with out multi-process.

4.Data format

5.使用方法

cd ./src
make
sudo ./miniftpd

Then you can connect this server by FTP in Linux.

You can run and test on your localhost, following the next step.

sudo ./miniftpd &
ftp 127.0.0.1

About

Implement of MiniFTP server with knowledge of Unix network programming.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages