0% found this document useful (0 votes)
14 views8 pages

Gavi

The document discusses two main network application architectures: Client-Server and Peer-to-Peer (P2P). It explains the functionalities of TCP and UDP transport protocols, detailing their connection methods and reliability features, as well as providing example socket programming code for both protocols. Additionally, it outlines DNS server interactions through recursive and iterative queries, illustrating how DNS queries are resolved through various servers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views8 pages

Gavi

The document discusses two main network application architectures: Client-Server and Peer-to-Peer (P2P). It explains the functionalities of TCP and UDP transport protocols, detailing their connection methods and reliability features, as well as providing example socket programming code for both protocols. Additionally, it outlines DNS server interactions through recursive and iterative queries, illustrating how DNS queries are resolved through various servers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Module 1

Q1. Network Application Architectures.


There are two different network application architecture, they are
1) Client Server Architecture
2) P2P Architecture
Client Server Architecture:
• In client-server architecture, there is an always-on host, called the server, which provides
services when it receives requests from many other hosts, called clients.
Example: In Web application Web server services requests from browsers running on client
hosts. When a Web server receives a request for an object from a client host, it responds by
sending the requested object to the client host.
• In client-server architecture, clients do not directly communicate with each other.
• Some of the better-known applications with a client-server architecture include the Web,
FTP, Telnet, and e-mail.
• In a client-server application, a single-server host is incapable of keeping up with all the
requests from clients. For this reason, a data center, housing a large number of hosts, is often
used to create a powerful virtual server.
• The most popular Internet services—such as search engines (e.g., Google and Bing), Internet
commerce (e.g., Amazon and e-Bay), Web-based email (e.g., Gmail and Yahoo Mail), social
networking (e.g., Facebook and Twitter)— employ one or more data centers.

Peer-to-peer (P2P) Architecture:


• In a P2P architecture, there is minimal dependence on dedicated servers in data centers.
• The application employs direct communication between pairs of intermittently connected
hosts, called peers.
• The peers are not owned by the service provider, but are instead desktops and laptops
controlled by users, with most of the peers residing in homes, universities, and offices.
• Many of today’s most popular and traffic-intensive applications are based on P2P
architectures. These applications include file sharing (e.g., BitTorrent), Internet Telephony
(e.g., Skype), and IPTV (e.g., Kankan and PPstream).
• Features:
▪ Self-scalability:
For example, in a P2P file-sharing application, although each peer generates workload by
requesting files, each peer also adds service capacity to the system by distributing files to
other peers.
▪ Cost effective: P2P architectures are also cost effective, since they normally don’t require
significant server infrastructure and server bandwidth.

Q2. Transport Services Provided by the Internet


The Internet makes two transport protocols available to applications, UDP and TCP.
TCP Services
The TCP service model includes a connection-oriented service and a reliable data transfer
service.
1) Connection-oriented service:
• In TCP the client and server exchange transport layer control information with each other
before the application-level messages begin to flow.
• When the application finishes sending messages, it must tear down the connection.
2) Reliable data transfer service:
• The communicating processes can rely on TCP to deliver all data sent without error and in
the proper order.
• When one side of the application passes a stream of bytes into a socket, it can count on TCP
to deliver the same stream of bytes to the receiving socket, with no missing or duplicate
bytes.
TCP also includes a congestion-control mechanism.
UDP Services
• UDP is connectionless, so there is no handshaking before the two processes start to
communicate.
• UDP provides an unreliable data transfer service—that is, when a process sends a message
into a UDP socket, UDP provides no guarantee that the message will ever reach the receiving
process.
• UDP does not include a congestion-control mechanism, so the sending side of UDP can pump
data into the layer below (the network layer) at any rate it pleases. (DIAGRAM).
Q3.define socket.demonstrate the working of UDP and TCP socket.
• A typical network application consists of a pair of programs—a client program and a server
program—residing in two different end systems.
• When these two programs are executed, a client process and a server process are created, and
these processes communicate with each other by reading from, and writing to, sockets.
• When creating a network application, the developer’s main task is therefore to write the code
for both the client and server programs.

Socket Programming with UDP


Before the sending process can push a packet of data out the socket door, when using UDP, it
must first attach a destination address to the packet. After the packet passes through the sender’s
socket, the Internet will use this destination address to route the packet through the Internet to the
socket in the receiving process.

UDPClient.py
Here is the code for the client side of the application:
from socket import *
serverName = ‘hostname’
serverPort = 12000
clientSocket = socket(socket.AF_INET, socket.SOCK_DGRAM)
message = raw_input(’Input lowercase sentence:’)
clientSocket.sendto(message,(serverName, serverPort))
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
print modifiedMessage
clientSocket.close()

UDPServer.py
from socket import *
serverPort = 12000
serverSocket = socket(AF_INET, SOCK_DGRAM)
serverSocket.bind((’’, serverPort))
print ”The server is ready to receive”
while 1:
message, clientAddress = serverSocket.recvfrom(2048)
modifiedMessage = message.upper()
serverSocket.sendto(modifiedMessage, clientAddress)

Socket Programming with TCP


• Unlike UDP, TCP is a connection-oriented protocol. This means that before the client and
server can start to send data to each other, they first need to handshake and establish a TCP
connection.
TCPClient.py
from socket import *
serverName = ’servername’
serverPort = 12000
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect((serverName,serverPort))
sentence = raw_input(‘Input lowercase sentence:’)
clientSocket.send(sentence)
modifiedSentence = clientSocket.recv(1024)
print ‘From Server:’, modifiedSentence
clientSocket.close()

TCPServer.py
from socket import *
serverPort = 12000
serverSocket = socket(AF_INET,SOCK_STREAM)
serverSocket.bind((‘’,serverPort))
serverSocket.listen(1)
print ‘The server is ready to receive’
while 1:
connectionSocket, addr = serverSocket.accept()
sentence = connectionSocket.recv(1024)
capitalizedSentence = sentence.upper()
connectionSocket.send(capitalizedSentence)
connectionSocket.close()

Q5. With the neat diagram,explain DNS server interaction with various DNS servers.

Two type of Interaction:


1) Recursive Queries: (DIAGRAM)
Here DNS query is sent to local DNS server then to root server, then to TLD server and finally
to authoritative DNS server. DNS response arrives in the reverse order.
2) Iterative Queries: (DIAGRAM)
Here DNS query will be sent to Local DNS server, then to root server. Root server sends the IP
address of TLD server. Now local DNS server sends query to TLD DNS server. TLD DNS
server sends the IP address of authoritative DNS server to local DNS server. Now Local DNS
server sends query to authoritative DNS server. Authoritative DNS server sends the IP address of
host to local DNS server. Local DNS server sends it to the host.

You might also like