Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

unit 5 computer networks

The document discusses the concept of sockets in computer networks, explaining how they facilitate communication between application layers and processes in a UNIX environment. It covers the roles of local and remote socket addresses, the TCP/IP protocol, and the differences between TCP and UDP in terms of connection-oriented and connectionless services. Additionally, it introduces the Domain Name System (DNS) and its structure, emphasizing its importance in mapping domain names to resource records for efficient internet communication.

Uploaded by

Madan Bommagani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
6 views

unit 5 computer networks

The document discusses the concept of sockets in computer networks, explaining how they facilitate communication between application layers and processes in a UNIX environment. It covers the roles of local and remote socket addresses, the TCP/IP protocol, and the differences between TCP and UDP in terms of connection-oriented and connectionless services. Additionally, it introduces the Domain Name System (DNS) and its structure, emphasizing its importance in mapping domain names to resource records for efficient internet communication.

Uploaded by

Madan Bommagani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 21
Socket ‘ram, SOMEUITER iene a raga 8 Advance Stem cal, Hettve and Application li ograms : | i Sess main Name Space (DNs) SIP. PrP. HTP ia | et di ‘ att interice i Set of instructions et os SUC Baty as pa of a UNIX environment. The operating system, as shi }OWn in fig, Iti. a gor cp comMUncation beween the application layer and the with affother process, "0S Set of instructions that can be used by ae ranean The idea of sockets allows us to th instructions already designed in a programming language for other sources and sinks, For eangis gemstone languages, like C, C++, or Java, wehave several instructions that can read and write data to other sources and sinks such a a Keyboard (a. source), @ monitor (a sink), nd sink). We can use the same instructions to read from or » We are adding only new sources and sinks to } Ora file (Source ai write to sockets, In other words, Fig,: Position of the socket interface. changing the way we send data or receive data fig. shows the id “sources and sinks. . hough a socket is supposed to behave like a terminal ora fi jt abotacton Shura pps ten the programming language ce Se sciaeateennaiamet YEAR iti SEMESTy nication between xd, communica a ch We can say that, as far as the application layer is SS ented ef two ends, ag amt process and a_gerver process is communication between two SOckel TT Cesk andl gives the r Figure 25.6. The client thinks that the socket is the entity ee ae needs the respons If we creat, wp server thinks that the socket is the one that has a reque frosses correctly, we can 14g the server think thatthe a : ye vouree and destination adres se soc at each end, and defin a the ‘lity of the operating st is the responsibility of the Operating systeny ag avai ons to send and receive data, The res TCP/IP protocol centserver paradigm i (peal cocket address and | remote “A socket address s tispussed in Chapter 18) nthe current Interr a pair of socket addresses, a local and a remote. / Finding Socket Addresses How can a client or a’server find a pair of socket add different for each site, Server Site The server needs a local (server) and a remote (client) Client Site The client also needs a local (client) anda remote (aca (server) Local Socket Address The local (client) socket address is The operating system knows the IP address of the comput. is a 16-bit temporary integer that is a ynit- Vv COMPUTER NETWORKS ret of integers we discussed 1 is not used ber to be st 1 to start the communication, The ‘ i port dine res sera eld the phar fry pt or any other running client proces. ‘ ee needs to a yo pe able to redirect the response received Gin fhe ace system needs to ridin tie pote mur | gemote Socket Address the server process to the client process that sent the reque ding th Finding the remote (server) socket address for a cient, how-ever, needs more work, When a cle ie i We will have two ess starts, it should ki roc’ now the socket address of the server it wants to connest to. Fruations in this Case. | ( ,) Sometimes, the user wh () Zadress of the computer eh drs lentinraness know et eae i anaes have written client and server appli le eever is running. This usually occurs in situations when we hive Ee one oo sve Wart test then: For examnpley at i erie es eee ee ple client and server programs and we test them using this approach. In , grammer can provide these two pieces of information when he runs the dient program. Although each standard application has a well-known port number, most of the time, we do not ntact a web pase: send the server has 2 know the IP adcress This happens in situations such as when we an.e-mail toa friend, copy file from a remote site, and so ©) ituations, the name, an identifier that uniquely defines the server process. Examples uch as WWW.XXx.Yyy, Or e-mail addresses, such as xxxx@yyyy.com. ssange this identifier (name) fo the corresponding server addre: knows the port number because it should be a well-known port nt obtained using another client-server application called the D ‘A pair of processes provide processes, however, need to use the this no physical communication at the application layer. Protocol ue ‘i ‘i . connectionless, unreliable, data service. Cor eee acenging messages. the two UDP does not coming from the. epee ugh it may check that ieaiata Bese sender to resend the corrupted or lo is messoge orice It gives boundaries to the ed to use IDP if it is sending small see any relation liab , some N YEAR 9 ~ hy sme parameters between haking, establishes some parat thes e of buffers to be used fo « of the data packets to be exchanged, the siz % na 7 tl the whole ei 1 eee and so on. After the handshaking process the wy gmonts teach rection, By numbering the bytes exchanged, the - wt OF CON rupted, the receiver ca cked. For example, if some bytes are lost ot cor : ie bytes, which makes TCP a reliable protocol. TCP also can provide flow ¢ eee ol, as we saw in Chapter 24. One problem with the TC P protocol is That i8 not mass not put boundaries on the messages exchanged. Most of the standard applies ong messages and require reliability may benefit from the service of the TCP called_hands! ments in each ¢ —_ CTP Protocol combination of the two other protocols. Like TCP, So e, but it is not byte-stream oriented. It is a message era ication between a clier ough several client programs cana be designed to respond iterativ Jes_a request, pro reques When; the server ist “eg wail Tor ‘the client to. connec faa filling this eat e the poche! rare COMPUTER NETWORKS Diagram As UDP provides a.connectionless service, in which a client sends a request and the server sends ack a response. Figure shows a simplified flow diagram for iterative communication. There are multiple , but only, one server. Each client is served in each iteration of the loop in the server. Note ‘ratthere \ectfon establishment or copnection termination. Each client sends a single datagram and receives , single datagram. In other words, if a client wants to send two datagrams, it is considered as two dents for server, The second datagram needs to wait for its tum. The diagram also shows the status of the socket fer each action Process The server makes a passive open, in which it becomes ready for the communication, but it waits nil a client_proc makes the connection, It creates an empty s then binds the socket to the fr andthe well-know port, in which only part of the socket (the server socket address) is filled (binding happen at the time of creation depending on the underlying language). The server then issues 3 seeive request command, which blocks until it receives a request from a client. The server then fills the est of the socket (the client socket section) from the information ‘Obtained in the request. The request is the process and the response is sent back to the client. The server now starts another iteration waiting for nother request to arrive (an infinite loop). Note that in each iteration, the socket becomes only half-filled ain; the client socket address is erased. It is totally filled only when a request anfives. nt Process The client process makes an active open. In other words, it starts @ connection. It creates an empty et and then issues the send command, which fully fils the The client ies a receive command, which is blocked until sn handled and the socket is destrayed. Fig.: Flow diagram for iterative UDP mex I YEAR I) SEMESTe, Explain iterative communication by using TCP (Imp) iving data, 4 connecti to TCP isa connection-oriented protocol. Before sending ot se Ee ablished, the hwo parties sae established between the client and the server. After the connect task iterative,communi si and receive churks of data‘as Tong as they have data to do so. f communication in this section "8 TRRis netery.common, because itis simpler we discuss this type 0 Sockets Used in TCP The TCP server uses two different sockets, one for connection extsbiahiney oan ane daty transfer. We cal the fitst one the listen socket and the second the socket. The ee aad daar of sockets is to separate the connection phase from the data exchange Rona cd, the te fet foulsten for a new cient tying to establish connection. After the connectig ETO aBAR as : ig data With the SGht the TCP server process, like the UDP server process, ¢ ands create the listen socket to be used only fo "procedure, to allow the operating sya and putting them in the waiting list to be € server process now starts a loop and serves the clients one by issues the accept procedute that removes one client from the wi ing. Ifthe list is COMPUTER NETWORKS yt! it Process The client flow diagram is almost similar to the UDP version except that the client data-transfer box eds 10 be defined for each specific case. We do so when we write a specific program later. EW Empty socket [ara] Hated socket FB Pits soc m for Iterative TCP commu Itis the top most layer of OS! Model, Manipulation of data( this ayer which ‘to get access to the network. So pteles aly tafe lo: denintng the pens ta i MYEAR Ill SeMee TER MCA Je it wants to the server Wide Web, When a browser wants a web page, it sends the name of the pag Using HTTP The Server then sends the page back tocol(FTP), Trivial File Tran, Other Application Protocols that are used are: File Transfer Proto fey Protoc: : in Name Systern (DNS) ot CTETP), Simple Mail Transfer Protocol (SMTP), TELNET, Domain Nai fc Functions of Application Layer i \d- storage. 1. Mall Services: This layer provides the basis for E-mail forwarding ans 2. licatic Network Virtual Terminal: It allows a user to log on toa remote ht cuceaal a software emulation of a terminal at the remote host. User's computer bebevel I caren which in tum, talks to the host and vice versa. Then the remote host belie ating with one of its own terminals and allows user to log on. ox 1 DNS (Domain Name System) (@& Abe phone book ae Gee | Explain in concept of Domain Name Systems, 4 ie cleinehd ee Quan Ae; P Omptey recs IP addvess pin SN £7 ap) Puls O08 as a transleley Hus Csr & human» Programs rarely refer to hosts, malboxes, and eh Instead of binary numbers, they use ASCII strings, such itself only understands bmsn addresses, $0 some mechanism is Fequired to convert the ASCII strings to network addresses. In the fol : sections will study how this mapping is accomplished plished inthe Intemet. <*> Fp) 4ype google 2 ayiles bnew « No 8102.56 Thanels pals. S Rahal Publications SENCES 4 Orkhers a ne WWs AMAZ9 02 Co My ER NETWORKS ywite¥ comput Way back in the ARPANET, there was simply a file, hosts.txt, that listed all the hosts and their, & wave Every night, all the hosts would fetch it from the site at which it was maintained, For a networ » few hundred large.timesharing machines, this approach worked reasonably well. However, when thousands of workstations were.connected to. the net, every-one realized that this proach could not continue to work forever. For one thing, the size of the file would become too large. _ i vever, even more important, host name conflicts would occur constantly unless names were centrally Fanaged, something unthinkable in a huge international network. To solve these problems, DNS (the pomain Name System) was invented, Conceptually, the Internet is di to several hundred top-level domains, K where each domain many hosts. Each domain is partitioned into sub-domait ind these are further partitioned, and ton. All these domains can be represented by a tree, as shown in Fig, The leaves.of the tree represent domains that have no subdomains (but do contain machines, of course) A leaf_domain may omen) single host, or it may represent a company, and contains thousands of hosts. J i eae a) ee | | Ce J MN ae x we I cs I Fig.: Aportion of he Internet domain name sf The top-level domains come in two flavors: generic and t (commercial), edu (educational institutions), gov (the U.S. federal go organizations), mil (the U.S. armed forces), fet (netv/ork providers), The country domains include one entry for every country, as defined in Each domain is named by the path upward from it to the (unt separated by perjods dot”). : engsun.com., rather than a UNIX-style name such as /com/sin/eng. No means that eng. does not conflict with a potential use of eng Used by the Vole Enlsh deparment Domain names can be either absolute or relative. An al (eg, engsun.com.), whereas a és not. Relati context fo 1 node in the tree and all the nodes under it, Domain names are case insensitive, so edu and EDU mean the be up to 63 characters long, and full path names must not exc B —_ MCA tt YEAR Ill SEMESTE are the resource recotds associated with that name. Thus the real furiction of DNS is to map domain names onto resource records, A resource record is a Five-uple_ Although they are encoded in binary fot ffcency wee expositions resource records are presented as ASCII text, ore line per resource record. The format we wy use is as follows: Domain_name Time_to_live Type Class Value 1. The Romain name tells the domain to which tis record apples. Normally mand Record eo each domain atid each copy of the database holds information about mul Se bea ea is thus the primary search key used to satisfy queries. The order of the sees ET mE ne significant. When a query is made about a domain, all the matching recor are retumed, STE Cri Fash i nace 201 ow), the > eA host. Every Internet host must have at least one IP address, so other m with it. Some hosts have two or more network connections, in which case. A resource record per network connection (and thus per IP address). The next most important record type is the MX record. It specifies the name: to accept email for the specified domain: of this record is to not on the Internet to receive email from Internet sites, Delivery isa Internet site make an arrangement with some Intemet site to accept whatever protocol the two of them agree on. Name Servers In theory at least, a single name server could a al In practice, this server would be so overloaded went the entire Intemet would be crippled. > COMPUTER NETWORKS Jo avoid the problems associated with having only a single source of information, the DNS name sace is divided up into nonoverlapping zones. One possible way to divide up the name space of Fig: is in Fig. Each zone contains some part of the tree and also contains name servers holding the authoritative information about that zone. Normally, a zone will have one ptimary name server, which its information from a file on its disk, and one or mote secondary name servers, which get their mation from the primary name server. To improve reliability, some servers for a zone can be located ‘outside the zone. —+| |+— counties —= Fig.: Partof the DNS na Where the zone boundaries are placed is made in large part based on how many name servers hhas a server for yale.edu that handles eng.valeedu but ‘own name servers, Such a decision might be made when, run its own name server, but a department such as ci ILYEAR Ill SEMESTER MCA dress of linda.cs.yale.edu. and probably does not know cs.yale.edu either, but it must know all of its See, so it forwards the request to the name server for yale.edu (step 3). In turn, this one ae the request to cs.yale.edu (step 4), which must have the authoritative resource tecords, Since oa request is from a client to a server, the resource record requested works its way back in steps 5 through 8. ‘Q7. Discuss about the components of e-mail, rs (Imp,) Email is a service which allows us to send the message in electronic mode over the intemet. It offers an efficient, inexpensive and real time mean of distributing information among people. E-Mail Address iemnail.s-assigned.a. unique and rete E-mail message comprises of diff These components are described in the fo ‘Ae De silxBluorasprtcon Wed an 221100 EDT 213] sie: Wed 22 un 2013110046 EDT 20134400 EDT) To sherri cam ‘Sone scent nshd of he Nak bean dp lst, Can one ‘yank up ante cant kan our vay home tek ‘nha ay $0 you mighthae a Tak io: 4a 347-2045 fac 00 347-0013, E-mail Header The first five lines. of an E-mail is mail ae mesage ' called E-mail header. The header part comprises of » FROM: The From field indicates the sender's address i.e, 'who sent the e-mail, » — DATE: The Date ficld indicates the date when the e-mail was sent, » TO: The To field indicates the recipient's address ie. 4, whom > R the e-mail is sent, See The Subject field indicates the Purpose of e-mail, It should be Precise and to the Rahul Publications COMPUTER NETWORKS CC: CC stands for Carbon copy. It inclides those recipient addresses whom we want to keep infotmed but not exactly the intended recipient BCC: BCC stands for Black Carbon Copy, It is used when we do not want one or more of the recipients to know that someone else was copied on the message. GREETING: Greeting is the opening of.the-actual message. Eg. Hi Sir or Hi Guys etc. TEXT: It represents the actual content of the message. SIGNATURE: This is the final,part of an.e-mail message. It includes Name of Sender, Address, and Contact Number, dvantages E-mail has proved to be powerful and relia are the benefits of E-mail: iable Rees 3 Many of the mail systems notify the sender if e-mail message was eee eae ae Speed: E-mail is very fast. However, the speed also depends Inexpensive: The cost of sending e-mail is very. low. : ‘Printable: It is easy to obtain a hardcopy of.an e-mail. Also an ele als6'be saved for records. e Global:: E-mail can be sent and received by a pergon sitting Generality: It is also possible to send graphics, programs and dvantages Apart from several benefits of E-mail, there also exist some disad Forgery: E-mail doesn't prevent from forgery, that is, someone i Overload: Convenience of E-mail may result in a flood of ma Misdirection: It is possible that you may send e-mail to an Junk: Junk emails are undesirable and inappropriate emails. Jupk e to as spam. t Beeson It may be frustrating when the recipient does xd Explain the working of e-mail System. t Exmail system comprises of the following three components; Mail Server: The function of mail server is to,receive, store ‘nail servers to be sunning all the time because if it crashes or Mailboxes: Mailbox is generally a folder that 1 YEAR I! SEMEsp MCA Working of E-mail 4 i the mail appi is client is the mailer i.e. Plicat Email working follows the client server approach. if fa client on ‘or mail program and server is a device that manages em: i d in sending and receiving em, Following example will take you through the basic paige ails and will give you a better understanding of working of emai i erson-B. » Suppose person A wants to send an email message to p i i id then select Seng 4 e. mail client an Person A composes the messages using @ mailer program i option. to person B’s mail server. ‘The message is routed to Simple Mail Transfer Protocol to per The m i B. isk i designated for person © mail server stores the email message on disk in an area designs Exmail Protocols are set of rules that help the client to properly transmit the information to or from the mail server. Here in this tutorial, we will discuss vari “sols such as SMTB ROR and IMAP SMPTE: SMTP stands for Simple Mail Transfer Protocol. It Was first q protocol used for sending e-mail Scien ae ae intern _ Key Points \ SMTP is application level protocol, P is connection oriented protocol, is text based protocol, Shanes ok messoes beeen ena servers over TEPIP network, “ COMPUTER NETWORKS post rom transferring e-mail, SMPT also provides Notification regarding incoming mail mal, 7 nen you send e-mail, your e-mail client sends it to your e-mail server which further contacts the 7 ecpent mail server using SMTP client these SMTP commands specify the sender's and receiver's e-mail address, along with the message 7 so be send. to the exchange of commands between servers is carted out without intervention of any user , MTP jn case, message cannot be delivered, an error report is sent to the sender which makes SMTP a ? reliable protocol, Commands ‘The following table describes some of the SMTP commands: Command Description HELLO: This command initiates the SMTP conversation. EHELLO: This is an alternative command to initiate the coeesation: ESMTP indicates that the sender server wants fo use extend SIZE: This command let the server know the data refers tothe body of the message. QUIT: This commands is used to ter VERFY: This command is used by the eee MCA I YEAR Il SEMESTE, Key Points F ithout hr > _IMAPallows the client program to manipulate the e-mail message on the server without downloading them on the local computer. > The e-mail is hold and maintained by the remote server. ut reading the > Itenables us to take any action such as downloading, delete, the arab he Ue mail. ff enables us to create, manipulate and delete remote message folders > IMAP enables the users to search the e-mails, f i ers, > It allows concurrent access to multiple mailboxes on multiple mail serve IMAP Commands of POP but the "GOP Sie en dena Key Points » — POP is an application ‘ayer intemet standard protocol, Since POP supports offline access to the messages, thus requires » POP does not allow search facility, " order to access the messaged, it is necessary to download them, * It allows only one mailbox to be created on server. » It is not suitable for accessing non mail data, POP commands are generally abbreviated into codes of thi Rahul Publications V nit Sg id ey Kk: i por Co The following table describes some of the POP comands mmands Command Description — LOGIN: This command opens the connection STAT: It is used to display number of messages LIST: I shown. currently in the mailbox. t is used to get the summary of messages where each message summary is RETR: This command helps to select a mailbox to access the messages DELE: It is used to delete a message RSET: It is used to teset the session to. its initial state. QUIT: It is used to, log off the session.3 Generally used to support single client. Messages are accessed offline. “Messages are accessed gpline although it also supports offline mode. | POP does not allow search facility. All the messages have to be downloaded. | "It allows selective transfer of messages to ‘the client. Only one mailbox can be created on the server. Not,suitable for accessing non-mail data. POP commands are generally abbreviated into codes of three or four letters, Eg, STAT. Mails once downloaded cannot be accessed from some other location, The e-mails are not downloaded automatically, Troi yon dniscion, essages Pe Sloéd 2 transmitted & destirol,, rd é 5 11 YEAR Ill SEMESTap MCA 5.3.2 SMTP Q11. How Simple Mail Transfer Protocol (SMTP) works? % (Imp) be delivery, An Simple Ma Simple Mail Transfer Protocol (SMTP) is based on end. deli mS et a Mail r Prot ansfer Protocol (SMTP) client contacts the destination host's Simp) fransfe tocol (SMTP) on well-known-port 25, to deliver the mail. The client then waits for the a send a 220 VAIL message. Upon receipt of the 220 message, the client sends a HELO command. The sponds with a “250 Requested mail action okay” message. message 354 Start mail command withia ent message data. The termination sequence consis return, and line feed’ (:), ee Se ee The dligntnow sends the data line by li pe - a Ones line, upon which the receiver will acknowled ich will "essages to send, the connection can be closed with a QUIT command, whi with @ 221 Service closing transmission channel reply, Exchange Roles: If the current Simple Mail Transfer Protocol (SMTP) client has namore mes send, butis ready to receive any messages from the current Simple Mail Transfer Protocol ( server Lean Issue the TURN command, Now the SMTP client and the SMTP server will satch role of sender/receiver, and the sender (previous receiver) can now send messages by issuing 2 MAIL command, Send I: If the Simple Mail Transfer Protocol (SMTP) client (sender) has another message to send, it can issue a new MAIL command, COMPUTER NETWORKS .3 File Transfer Protocol (FTP) 2, What is FTP - File Transfer Protocol? ; (imp.) es files between local and connections are used by— File Transfer Protocol(TP) is an @ emote file systems. It runs on the top of TCI ote fi like HTTP. if’ parallel: control connection and data connection. — —= P’sends the control information out-of-bs on, they are said to send their control information MCA FTP Session " Jient initiates a When a FIP session is started between a cont nde seven he er ie the a 1G . ry . " i al connection with the server side. The client sends the control or a 5 ie Gi be tele receives this, it initiates a data connection to the client side. Only_on agree me data : ser session. AS we know connection. But the control connection remains active et we nil & dale de stateless ie. it does not have to keep track of any user stale. But Bia! user throughout the session. Data Structures FTP allows three types of data structures ture there is no internal structure an the file is considered to by , a. TOR: re aie into i LIST: Sends a request to display the list of all the files 1 ABOR; This command tells the server to abort the previo } transfer of data. | » QUIT: This command terminates a USER and if file tra cantrol connection. FTP Replies ~ Some of:the FTP replies are > — 200->Command okay. > 530 Not logged in. . sae > a | User name okay, need password, ae ‘connection open; no transfer in progress, st a ‘Rahul Publications aE ot commuter NETWORKS 1 Serie closing conto connection , spi Rewested action aborted: page type unknown. ’ go-conmand not implemented yy Bad sequence of commands r 04 5 Command not implemented for that parameter So) ia a. & parc 65 wor’: ‘ous FTP qnymous FTP is enabled on some sits whose fils are available for pul hse fs without having any usemame or password, Instead, sername is jt guest by default: Here, the user acces is very liited. For example, th Hy les but not to navigate through directories > BY wWioy ATP we can access 2 dats on THtaret ENA. Explain the features of HTT. «FTP + SNTP > HTTP bfic access. A user can et to anonymous and user can be allowed ‘Protocol (HTTP) is an application-level protocol for distributed, collaborative, Fea THES Te foundation fr dala communication forthe World Wide Web 990. HTTP is a generic and stateless protocol which can be used for other Purposes ons of its request metheds, enor codes, and head. sically, HTTP.is.a TCPAP based communication protocol, that is sfles, query esuls, et.) on the World Wide Web. The default port is wel. It provides a standardized way for computers to. es how clients’ request data will be constructed w hr eee bs etes tole HTTP inl but power teak _ HTTP is connectionless: The HTTP client. a brouser inate an HTTP request and aftr a " feustis made, thecent diconneds fom he server and was fora response, The server Processes ‘the request and re-establishes the connection with the client to send a response back. } HTTP is media independent: It means; any type of data can be sent by HTTP as long as both the lent andthe server know how tohancle the content, Its fequired for the client as well as the server to specify the content type using yppropriate MIME-type. 5 = HTTP is stateless: ‘As mentioned above, HTTP is connectic being a stateless protocol. The server and client are "request. Afterwards, both of them forget about each other, Due: ‘nature of the protocel, . nelther the clint nor the browser can retain information between ifferent requests across the web Pages, a : HTTP/1O uses anew connection for ech requesttesponse exchange, where as HTTP/1.1 connection ‘ay be used for one or more request/response exchanges,

You might also like