Application Layer | Application Layer: FTP | Alison
Loading

Module 1: Application Layer

Notes
Study Reminders
Support
Text Version

Application Layer: FTP

Set your study reminders

We will email you at these times to remind you to study.
  • Monday

    -

    7am

    +

    Tuesday

    -

    7am

    +

    Wednesday

    -

    7am

    +

    Thursday

    -

    7am

    +

    Friday

    -

    7am

    +

    Saturday

    -

    7am

    +

    Sunday

    -

    7am

    +

Application Layer: FTP
Hello, we will continue our discussion on Computer Networks and Internet Protocols.We were discussing on Application Layer protocol or different protocols, which areprominent in the application layer and today’s discussion will be primarily on FTP or, butbefore that we will have a quick overview of the client server system, right. Now thisclient server paradigm is I believe that well known to all of us, but it is for the sake ofunderstanding, we will relook at the thing. Now this is a as we understand this clientserver paradigm is a predominant paradigm in our for application different applicationrunning over the internet. It helps us two application talking to each other across thenetwork, right.So, what is the basic philosophy? So, there is a server program and corresponding clientprogram right, like we know that there should be if I am doing FTP, there should be aFTP server and corresponding FTP client. Similarly, if I am doing a say telnet. So, thereshould be a telnet server and there should be a telnet client and like this, right, the serverand client can be on the same machine or in the different machine.So, if it is a different machine, then the client server needs to know that the client needsto know where the server is and make a connection before establish a connection beforethe communication going on. So, what we are trying to at done at the basic at theunderlying level we have some applications which will work over the network. Andbasically rely on this network typically TCP/IP or OSI or network models and theapplication can run over the this network, right. So, later on in this course, we will lookat some other things like web services, service-oriented architecture, but the predominantapplication layer processing or what we say application layer communication is will bedone, we will be seeing the client server model.(Refer Slide Time: 02:38)So, standard model for developing network application; so, as we are discussing andnotion of client server a server is a process that is offering some service, right, as wenormally know. And a notion of a client is a process that is requesting for a service, rightlike if I have a print server, a print client is requesting for the service in the for theprinter, you many of you are accustomed with network level printer where over thenetwork, we request for that service, even these days, we are using network where meansa paradigm which is where you can connect or project something display somethingusing a using the underlying network, right. So, that is anything any such applications,which is giving service has to be this is typically known as the client server. And therequest requesting process is the client process right.Server or client may be running on the different machine or in the same same machine,all right, if it is on the same machine or different machine, the way of handling the wholething remains same, server waits for the request from the client. So, in other sense, if welook at, server is always active waiting for the request from the client to happen, like oneof the very popular paradigm is our http server, right, any document you want to accessover the internet, over the using our browser, so, what we see that “http://www say iitkgpdot ac dot in” right.So, there are two things that are the iitkgp server, which is which is there in somewherein IIT Kharagpur network or somewhere in the internet will respond back once the clientthis type of request is there. So, this browser my typical browser or your browser isacting as a http client and the server machine is responding to that. The server is alwayswaiting for a client to be request. So, it is waiting for the client to send their request andrespond accordingly, based on that the if the respond is successful and the format iscorrect etc that is other part of the things, but it will respond to the nothing whereas, theso, I have http server typically known as “httpd” or http daemon in terms of Linux orstuff like that and I have a http client, which is http client or typically if it is http client,we this is manifested by our standard browsers web browsers.(Refer Slide Time: 05:15)So, what we see there is a server and there can be multiple clients. So, immediately twothings pop up that whether the server will serve one client after another that is whether itis a iterative server one server subcede second server, etcetera, etcetera, like that. So, itthat can be iterative server or all the servers all the clients are served together. So, I havea concurrent server, right.So, number of requests are being served together and the limit based on that the resourceavailability etcetera the number of servers can be served together right and this whetherwe will look at in couple of sites there, whether it is iterative or the concurrent based onthe application requirement right, some resources where the server is handling maybe hasto be done iterative way. So, the other things has to wait or so, some of the most of thecases, it can be served concurrently like typically http servers. So, that can be servedconcurrently.(Refer Slide Time: 06:16)So, typical scenario the server process starts on some computer system, initialize itselfand then goes to sleep waiting for the client to request, right. So, this is the thing a clientprocess starts as an as the client needs it either on the same system or some other systemright, sends a request to the server.So, this is the typical scenario and whenever whether whatever the client serverparadigm things are there, that has to be the this sort of mechanism has to be there. Therecan be different way of handling, some can have more than one connect connection to beestablished, some single connection to be established that is protocol dependent, butnevertheless this has to be satisfied.(Refer Slide Time: 07:00)When the server process finished providing its service to the client, the server goes backto sleep waiting for the next client request to arrive.So, once it is the finished, it is the it will goes back to sleep the process repeats when thethings are there, this is the very vanilla type of operation, but it describes the things howit works.(Refer Slide Time: 07:23)So, as we are discussing the role of client and server processes are asymmetric, they arenot there can there are may not be symmetric and two types of servers there, one is as weare discussing iterative server another category of server, what we called concurrentserver which serves concurrently and iteratively one by one.(Refer Slide Time: 07:44)So, iterative server used when the server process knows in advance, how long it takes tohandle each request and handle each request itself and type of things or more specificallywhen there is a requirement, which goes for an iterative things. The resource allocationshould be done one after another, so that all cannot bumped into the things like I have asome resource, some say some sort of a resource to be reserved and type of thing and Icannot do concurrently maybe, I may have to do iteratively one by after one after anotherand in most of the cases we have some estimate that how much time it will take inworking on it so, that I can have one step another. The single copy of the server runs allthe time right and a client may have to wait if the server is busy right or in this case oneserver a one copy of the server or the server process is only one process.So, it is running all the time it serves goes to the next, next, next, next. So, it is a iterativeway of handling the thing.(Refer Slide Time: 08:52)Whereas, concurrent server were used when the amount of work required to handle arequest is unknown right. So, if the concurrent server is required when the amount ofwork required to handle a request is not known, right, the server starts another process tohandle each request, right. So, the server starts other process or in other sense myrequirement or my way of delivery is concurrent right, like I have a say iitkgp website ormy own website or something which I can serve concurrently. So, that is one way.So a copy of server caters to the client requests in a dedicated fashion. So this isimportant right, so a copy of the server, so what it does? It is those who are accustomedwith some sort of OS programming, there is a concept of forking right, so, forking achild process. So, some sort of forking a child process the server fork a child process,which goes on serving the request of that particular client and then it again comes backand listen to the start listening to the client request, right.So, it makes a self copy of the things which goes on serving the things as many of thecopies of the server, there can be many client requests. So as much as based on theresource availability, the amount of the number of copies will be going on serving theclient request.(Refer Slide Time: 10:23)So, whether TCP or UDP, again, what is the requirement of the application. Before startof communication the connection has to be established between the host, right, it can bea connection-oriented service like FTP type of things or it can be a connectionlessservice right either UDP like say DNA, sub DNA type of things where or DNAsresolution that can be a UDP type of services based on the what the application needs,right.So, if you see, what we require to make a connection establish? We require 5 things, rightthat IP of the server, port of the server where the server is listening, right. So, what so, ifin our terminology, what we in network terminology, what we see that what we see thatto identify a system we require IP address to identify a process in the system, we requirea port. So, IP plus port combinely defines the process of the thing as the server process.So, I require the IP of the server and IP of the port number of the server process where itis listening, on the other hand, I require a client IP of the client right, where thecommunication is other part of the communication and the port of the client, where towhich it is the client process is communicating. So this four thing apart from that werequire that underlying protocol.So, in most of our cases what we work on is the internet protocol is our predominantprotocol. So, it is most of the cases is the IP protocol which, but nevertheless it definesthat thing this combination. Now if it is the same machine the IP will be same. So, serverIP, client IP will be same, but nevertheless the port number will not be same even theprotocol is also same. So, this port will distinguish that two connection that is why assaying that if I open up a http server, right I am requesting for I am multiple browser inmy windows open. And I am requesting say iitkgp page one and some other things sayIIT Delhi something IIT Chennai, IIT Madras and type of things and, but it is not likethat request of these we will go to the thing, right. So, they are in they are these five tupledistinguishes stuff distinguishes every connection or defines every connections. Now sowhat we require to develop a network application. So, at the data link layer we requireethernet at the network layer we require IP.(Refer Slide Time: 13:05)At the transport layer use of TCP or UDP and there is a concept of Berkeley socket, wewill do some socket level programming at some part of this course show you that howthings works, but nevertheless there is a Berkeley socket interface.(Refer Slide Time: 13:24)So, socket is a, what we can say it is a methodology or a mechanism by which interprocess communication or IPC works, right. So, its a mechanism by which this interprocess communication works, it is used to allow one process to speak to another onsame or different machine, right. So, what we say, that I establish a socket between thesetwo processes and this IPC or Inter Process Communication works over this socket orthose who are or all of you have some working experience on C or type of languages. So,what you see that if you open a file in a C language what we require a file ID tocommunicate right rest of the things right here also I get a socket id. So, I establish acomm communication like using this over five tuple to be satisfied. And once that isdone, I have that socket id which allows me to transfer traffic, transfer the data over thethings, right. So, it is used to allow the process to speak to one another same or differentmachine some analogy like telephone is used to allow one person to another in that thatis a very straightforward analogy that it allows to this, but socket gives me a mechanismor method to have this IPC or inter process communication to happen, right. So, in orderto establish a socket; so, what we do I the socket the socket mechanism to be supportedby the system in most of the Linux system, they are supported. So, what you require yourequire a socket to be opened at the client end. So if I server end. So server opens up awhat we say some sort of a half socket, right. So, it its own IP own port and the protocolright and wait on that port that is client to get the request. Client on its other end opensup another half socket like its IP port and the protocol and it knows that client server IPright, that has to be known right. If I want to do a FTP to a remote machine I need toknow the IP or the URL or the name of the things like you know that iiitk www dotiitkgp ac dot in or unless you know this name then you can’t find the iitkgp page.Now this name will not be applicable for any communication over the network right. So,network layer understands only the IP address. So, that has to be resolved by the DNS.So, DNS returns a IP. So, in other sense I should know the IP address in some way orother of the destination. So, the client sends a say some sort of a connection request tothe server server on things, if it is find the format, etcetera everything protocol wisematching, then establishes this 5 tuple. And that establishes a socket between these twoclient server client and server. Using this socket id the rest of the communication goes onlike data transfer and others, etcetera, both way, etcetera.(Refer Slide Time: 16:49)So, when two process located on the same machine to communicate we defined aassociation defined a association and a socket. So, these are the as we have discussed, sowhich will have a protocol, IP local IP, or I say client IP client port server, IP server port.(Refer Slide Time: 17:06)So, a typically also called a half association as we are discussing that at the things. So,protocol local IP local port or protocol client IP client port or protocol remote there isserver IP server port and it once that communication path is there established and thegoes on. So, that is in some sense defines that how this client server protocol works.And all of our discussion what you are working on like most of the protocols are clientserver based as of now right, so one of the protocol very predominant protocol is the FTPwe are mostly used to that. 
Application Layer: FTP
So, what it facilitates transfer of files over network, it is a client server model oftenworks with TCP or connection-oriented reliable service and also telnet protocol. Thedefinition or the spec of the FTP is defined in RFC959 those who are interested can lookinto those RFCs, RFC.(Refer Slide Time: 18:12)So, a FTP uses TCP at the transport layer. So, it is the application layer down the layerdown layer is the transport is the TCP to provide reliable end to end connections andimplements two type of connection managing the data transfer.So, first of all it uses TCP layer in the transport mode and then it implements twoconnection. So, one for control and one for data, we’ll come to that. The TCP clientinitiates the first connection, referred to as control connection right on well known port21. So, that initial connection is the port, it is it is on this port that the FTP server listensfor the accepts of the new connection, so that means, FTP server if my linux time I sayftpd it once it initializes, or in other our socket terms makes a half socket and listens tothat port 21, is any FTP requests there? sort of thing and the FTP client coming out fromany port, it does not matter and then hits to that particular server at port 21, right. So, it isthe default port of port 21.So, when you give FTP by default, it knows that it goes to port 21 if you want to changethe port 21 to some other port at the server end, if you have changed then the thatparticular port to be the connection request should come to that particular port supposethe port is instead of 21, it is say something 8 8 8 8 or something right. So, it has to beequal on 8 8 8 8. So, that it says that you go for that service at that particular port, butanyway without going to that complicacies we see that its port 21 is the default port. Thecontrol correction is used for all control commands a client server uses to log on to theserver, manipulates file, terminates session, etcetera, right. This is also connection acrosswhich FTP server will send messages to the client in response to this control command,etcetera. So, those are those are also defined in the things, we will see that some of thepopular control commands, data commands etcetera at the end of this lecture.(Refer Slide Time: 20:20)The second connection of the FTP is referred to the data connection. So, typically thedata connection is established at port 20.So, 21 is the control port 20 is the data connection; however, depending on how the howthe data connection is established, both the client server might be might use ephemeralports. So, that can it may happen that 21 is the control panel, but the data client servercan agree upon to use a the some other ephemeral port for that things. FTP transfers dataover the data connection. FTP only opens a data connection, when the client issues acommand requiring a data transfer, right such as request to retrieve a file or list the list offiles, etcetera, different kinds we will again we will has a has mentioning I will see will Iwill show you some standard commands anyway those are things available in any bookor any over the network, but nevertheless we will popular commands data, data transfercommands also, we will show you. The data connection is unilateral - file can transferdata only from client to server or from server to client or not both. So, that is one wayeither this or this. So, it is not the both can cannot go simultaneously, right, the dataconnection can be initiated either by the client or the server the data connection initiatedby the server are active, while those initiated by the client are called passive, right. So, itcan be initiated by the both the things and the connection established by the server arecalled active connections or the initiated by the client are passive.(Refer Slide Time: 21:59)So, if we look at the basic operations so, it is a client server model. So, it is based onwhat; we have discussed at the initial part of this lecture. So, connection is controlconnection is typically port 21 uses to send and receive FTP commands. Data connectionis typically port 20 used to upload and download files right, process the data transferprocess two type of things are processes are there, one is the data transfer process or letus refer it as DTP, establishes the connection and managing the data channel. Anotherwhat we say protocol interpreter or pi, right. So, interprets the protocol let us let DDP becontrolled using command received from the control channel. So, the one is protocolinterpreter to interprets the protocol and the DTPA data transfer protocol uses thecommand to transfer the files.(Refer Slide Time: 22:59)So, again to continue with the basic operation.So, to as we had discussed there are two mode; one is active mode control connectionport client, there are large port numbers server at port 21, data communication port is atthe client is N plus 1 server is port 20, right. So, this is the in active mode in the passivemode control connection port. So, client a large port number should be more than 1023and server is port 21 data connection client is again N plus 1 server, large port number ofany greater than 1023; that it means that not those reserved port or restricted port.So, file transfer mode can be either ASCII that is txt, html and etcetera, etcetera or it canbe binary like doc, pdf, some media file so on. So, you need to define I can define thatthe type of things whether it is ASCII or binary or bin can be defined and can betransferred.(Refer Slide Time: 24:00)So, the same thing if we try to look at that the client FTP is build with a protocolinterpreter, a data transfer process and a user interface. So, if you if you have your FTPclient like there are very there are several open source client. So, you it has a userinterface and underlying it has a protocol interpreter and a data transfer process or PI andTTF, right a DTP data transfer process.So, what it does at the server end also there is a protocol interpreter and DTP. So, it oneis for the control connection, one is the data connection and we have two file systemright, at the client side one file system and also server sign two file system. So, either filedata can be transfer from here to here or other way, but we have two file system. So, atthe client end, client has a user interface to do that right, there are command line thingsalso those who are accustomed can do FTP connection and do the commands at the basicat the at the command line.(Refer Slide Time: 25:11)So, FTP clients user interface communicates with the protocol interpreter which managesthe control connection the same thing, PI translate any application specific command tothe RFC architect FTP command. So, that there is a application specific command, so itshould be RFC architect FTP command it has to be there otherwise the server side willnot understand or the same thing true for server to client side. So processes commandand then communicates these control commands to the server end. The FTP server PIreceives this command and then initiates the appropriate processes to receive to servicethe client request right. If the request require the transfer of data if there is a data transferinvolved, the data management is performed by this DTPs, right both the end and boththe client server applications, right.So, first the PIs PI will take care of that control connection established and if there is adata transfer involved then the DTPs will come into play. After the completion of thedata transfer the data connection is closed, control is returned to the PIs of the client andserver applications and only one data transfer can occur at each connection if multipledata transfer are required on a single FTP session, one distinct control connection will beopened for each transfer right, either, it can be managed at the upper level that going ondoing that at the or user interface or the FTP client program takes care all the individualdata connection has to be established right for the each data transfer.(Refer Slide Time: 26:55)So, if you look at the user perspective. So, what is the user perspective connect to theremote host, navigate and manipulate the directory structure right. I can go to thedirectory structure of the remote host or there if there is a permission is there, I canmanipulate. List files available for transfer. Define the transfer mode, transfer type anddata structure right, once I want to transfer. Transfer data to and from the remote host.So, either it can be from to client to the server or server to the client. Disconnect theremote host whenever the whenever the work is over. So, that they can be the typicalway of looking at it.So, there is another concept called TFTP. So, it is I thought that it would be good toknow. So, it is a for known as trivial FTP protocol. So, it is a low payload FTP protocol,right. So, typically widely used in say you want to upload a configuration file in a routeror network device and type of things, where much resource are not enabled, this TFTPplays a important role, this simplistic approach has many benefits over traditional FTP asbecause it is a very simple vanilla approach to the things used by diskless devices todownload firmware at boot time, right. So, diskless devices used by any automatedprocess for which the assignment of a user idea password is not feasible; that means,there are that is that much resource is not there, small application size allowing it to beimplemented in various devices right, various low resource devices and in environmentalresource there is resource requirement is not is much layer or lace or constrainedresource requirement TFTP is implemented on the top of the UDP user datagramprotocol.This is interesting right, FTP is typically over TCP, TFTP is typically over UDP, that it isnot reliable transfer. The TFTP client, initially send retry request through the well knownport 69. So, it is not that our port 21 like that. The server and the client then determinethe port that will use for the rest of the connection. So, initially that request 69 and thenagreed upon a thing. TFTP lacks most of the features of FTP and instead, it is limitedonly reading a file from a server or writing a file to a server. So, it is more of a updatingor reading or updating the server. TFTP has no provision for user authentication in thatrespect it is insecure protocol, but the the places or the, but the situation where we use,we it plays the important role like up updating a firmware and those things where I canensure security by different mechanisms, right, I that compromising that channel may bemore difficult, because there may not be external connection like that and other things.(Refer Slide Time: 30:46)Then we have some quickly go to some commands these are available in the books theseare these are taken from different sources including books. And what I thought that it willbe these are the typical command it will be good. So, USER, PASS, ACCT, etcetera likeuser information, password, account information, re-initialization, logout, aborting,previous commands are some of the access commands.And there are file transfer command like RETR, retrieve files, STOR store files and soand so forth, right.So, there are several sets of transfer file there is a command called STAT to return thestatus status of that set of files. So, with this what we see a in this particular today’slecture, we primarily discusses that how what is the basic philosophy of client server, wejust introduced there socket program, we’ll in some of the subsequent lectures or some ofthe session, we will try to will show you some how this programming can work and howwe can write your own network label programs into using this socket.So, that we will, so we discussed about FTP, one of the very predominant applicationlayer protocol used for primarily for transferring data, uses two ports one for control andthe data port and also another variant of FTP, which is a low payload FTP or TFTP,which is used for several firmware updates and other configuration updates in deviceswith constrained resources. So, with this let us stop let us stop our today’s discussion.Thank you.

Notification
You have received a new notification
Click here to view them all