Sunteți pe pagina 1din 16



1. List the advantages of using java for network programming? And Why
Ans: Network Programming: Computer network programming involves writing computer
programs that enable processes to communicate with each other across a
computer network.
Examples: Tcp(Transmission Control Protocol) ,Sequenced Packet Exchange (SPX))

Advantages of java using in network programming

 Java offers higher cross- functionality and portability as programs written in one
platform can run across desktops, mobiles, embedded systems
 Java is free, simple, object-oriented, distributed, supports multithreading and offers
multimedia and network support.

 Java is a mature language, therefore more stable and predictable.

 Relatively seamless forward compatibility from one version to the next

 The Java Class Library enables cross-platform development.

 Being highly popular at enterprise, embedded and network level, Java has a large
active user community and support available.

 Java has powerful development tools like Eclipse SDK and NetBeans which have
debugging capability and offer integrated development environment.

 Increasing language diversity, evidenced by compatibility of Java with Scala, Groovy,

JRuby, and Clojure.

Why Networking

 File Sharing
 Hardware sharing
 Application sharing
 Communication
2. What are the various function of a network program? Or Components of network.
Ans: There are n number of functions in network programming; some of them are as
Servers - Servers are computers that hold shared files, programs, and the network operating
system. Servers provide access to network resources to all the users of the network. There are
many different kinds of servers, and one server can provide several functions. For example,
there are file servers, print servers, mail servers, communication servers, database servers, fax
servers and web servers, to name a few.
Clients - Clients are computers that access and use the network and shared network
resources. Client computers are basically the customers(users) of the network, as they request
and receive services from the servers.
Transmission Media - Transmission media are the facilities used to interconnect computers in
a network, such as twisted-pair wire, coaxial cable, and optical fiber cable. Transmission media
are sometimes called channels, links or lines.
Shared data - Shared data are data that file servers provide to clients such as data files, printer
access programs and e-mail.
Shared printers and other peripherals - Shared printers and peripherals are hardware
resources provided to the users of the network by servers. Resources provided include data
files, printers, software, or any other items used by clients on the network.
Network Interface Card - Each computer in a network has a special expansion card called a
network interface card (NIC). The NIC prepares (formats) and sends data, receives data, and
controls data flow between the computer and the network. On the transmit side, the NIC passes
frames of data on to the physical layer, which transmits the data to the physical link. On the
receiver's side, the NIC processes bits received from the physical layer and processes the
message based on its contents.
Local Operating System - A local operating system allows personal computers to access files,
print to a local printer, and have and use one or more disk and CD drives that are located on the
computer. Examples are MS-DOS, Unix, Linux, Windows 2000, Windows 98, Windows XP etc.
Network Operating System - The network operating system is a program that runs on
computers and servers, and allows the computers to communicate over the network.
Hub - Hub is a device that splits a network connection into multiple computers. It is like a
distribution center. When a computer requests information from a network or a specific
computer, it sends the request to the hub through a cable. The hub will receive the request and
transmit it to the entire network. Each computer in the network should then figure out whether
the broadcast data is for them or not.
Switch - Switch is a telecommunication device grouped as one of computer network
components. Switch is like a Hub but built in with advanced features. It uses physical device
addresses in each incoming messages so that it can deliver the message to the right destination
or port.
Like a hub, switch doesn't broadcast the received message to entire network, rather before
sending it checks to which system or port should the message be sent. In other words, switch
connects the source and destination directly which increases the speed of the network. Both
switch and hub have common features: Multiple RJ-45 ports, power supply and connection
Router - When we talk about computer network components, the other device that used to
connect a LAN with an internet connection is called Router. When you have two distinct
networks (LANs) or want to share a single internet connection to multiple computers, we use a
Router. In most cases, recent routers also include a switch which in other words can be used as
a switch. You don’t need to buy both switch and router, particularly if you are installing small
business and home networks. There are two types of Router: wired and wireless. The choice
depends on your physical office/home setting, speed and cost.
3. What is the importance of security in network programs? And Why java in
networking,What can N/W program do.
Ans: Network Programming: Computer network programming involves writing computer
programs that enable processes to communicate with each other across a computer network.
Why java in networking?
 Designed for networking
 Platform independent
 Security
 Easy to program

Importance of Security in network programs

cannot access arbitrary address in m/y.

Cannot access the local file system.

Cannot print documents.

Cannot access clipboards.

Cannot launch another programing client.

Cannot reveal information about the remote user.

Cannot define system properties.

Cannot create/ manipulate threads not in same thread group.


4. Give Detailed Description of TCP and UDP? (10 marks) and what is UDP Protocol?
TCP: Transmission Control Protocol
TCP is one of the main protocols in TCP/IP networks. Whereas the IP protocol deals only
with packets, TCP enables two hosts to establish a connection and exchange streams of
data. TCP guarantees delivery of data and also guarantees that packets will be delivered in
the same order in which they were sent.
TCP Block Diagram

 Slower but reliable transfer.
 Typical application: Email, Web browsing.
 TCP is unicast.
 Layered on top of IP
 TCP (Transmission Control Protocol) is a standard that defines how to establish and
maintain a network conversation via which application programs can exchange data.
 TCP works with the Internet Protocol (IP), which defines how computers
send packets of data to each other.

 TCP is a connection-oriented protocol, which means a connection is established and

maintained until the application programs at each end have finished
exchanging messages.
 It determines how to break application data into packets that networks can deliver.
 Sends packets to and accepts packets from the network layer,
 Manages flow control, and—because it is meant to provide error-free data
transmission—handles retransmission of dropped or garbled packets as well as
acknowledgement of all packets that arrive
 Example: Video Streaming ,image , audio ,transfer ,etc.
UDP: User Datagram Protocol
Definition: User Datagram Protocol (UDP) is part of the Internet Protocol suite used by
programs running on different computers on a network.
 Fast But non-guaranteed transfer
 Typical application: VoIP and Music streaming.
 It contains Unicast ,multicast, broad cast
 Unreliable
No order

No Ack.

Not suitable for lossless transmission

Maintain order

No packets lost

Eg: file transfer, etc

5. Explain TCP/IP layering in detail with neat sketch? (10m)
Ans: TCP/IP is one of the Internet standards in network programming

TCP/IP layer (only draw TCP/IP ) if you want osi also draw np.

TCP/IP Model Layers

Each layer of the TCP/IP has a particular function to perform and each layer is completely
separate from the layer(s) next to it. The communication process that takes place, at its simplest
between two computers, is that the data moves from layer 4 to 3 to 2 then to 1 and the
information sent arrives at the second system and moves from 1 to 2 to 3 and then finally to
layer 4.

Application Layer

The application layer is concerned with providing network services to applications. There are
many application network processes and protocols that work at this layer, including Hypertext
Transfer Protocol (HTTP), Simple Mail Transport Protocol (SMTP) and File Transfer Protocol

At this layer, sockets and port numbers are used to differentiate the path and sessions which
applications operate. Most application layer protocols, especially on the server side, have
specially allocated port numbers, e.g. HTTP = 80 and SMTP = 25, and FTP = 20 (Control), 21
Transport Layer

This layer is concerned with the transmission of the data. The two main protocols that operate at
this layer are Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). TCP is
regarded as being the reliable transmission protocol and it guarantees that the proper data
transfer will take place. UDP is not as complex as TCP and as such is not designed to be
reliable or guarantee data delivery. UDP is generally thought of as being a best effort data
delivery, i.e. once the data is sent, UDP will not carry out any checks to see that it has safely

The Internet Layer

This is the layer that contains the packet construct that will be transmitted. This takes the form
of the Internet Protocol (IP) which describes a packet that contains a source IP Address,
destination IP Address and the actual data to be delivered.

Network Access Layer

This is the lowest level of the TCP/IP protocol stack and functions carried out here include
encapsulation of IP packets into frames for transmission, mapping IP addresses to physical
hardware addresses (MAC Addresses) and the use of protocols for the physical transmission of

Note: TCP/IP is actually a suite of protocols sometimes referred to as the Internet Protocol
6. Write a short note on XMl and HTML .list the advantages of XML over HTML?
XML: In computing, Extensible Markup Language (XML) is a markup language that
defines a set of rules for encoding documents in a format that is both human-
readable and machine-readable.
XML stands for Extensible Markup Language and is a text-based markup language
derived from Standard Generalized Markup Language (SGML).

 XML refers to extensible markup language

 XML is one of the Extensible markup language
 Tags can be customized by programmer

 Store large volume of data

 Transport data b/w applications

 Example:
<body>Don't forget me this weekend!</body>
 XML is extensible
 XML carries the data, does not present it
 XML is a public standard
HTML: Hyper Text Markup Language

->HTML stands for Hyper Text Markup Language,

->which is the most widely used language on Web to develop web pages.

->HTML was created by Berners-Lee in late 1991 but "HTML 2.0" was the first
standard HTML specification which was published in 1995


<!DOCTYPE html>



<title>This is document title</title>



<h1>This is a heading</h1>

<p>Document content goes here.....</p>


List the advantages of XML over HTML

 XML encodes data in tightly validated tree structures. Data is easy to locate since its
context is well defined by tags and rules of structure.
 HTML attempts to control the appearance and presentation of data, while XML does
not. XML defines data separately from its presentation. This makes XML data easier to
locate and manipulate.
 XML is a standard data format that permits applications to exchange information across
platforms and operating systems. HTML is markup used to display information in a web
 XML is open and extensible. XML authors can create their own tags. HTML is limited by
a fixed vocabulary that browser developers have agreed to support. In fact, XML has no
predefined tags of its own. New XML tags are defined as needed —to define any type of
data using syntactical rules that that permit browsers and XML Parsers to interpret
proprietary tags on the fly. XML can describe any kind of data, such as a row in a table,
a chemical formula, a financial transaction, a short story, or an object that exposes
methods and properties—with equal finesse.
 Since XML is plain text, it is easily transmitted between computers and through
firewalls. XML is more secure than binary files, since text files cannot be executed
directly. Binary files, on the other hand, can contain malicious computer programs.
 XML is universally compatible. The XML file format is not tied to any particular program,
operating system, database, or network. XML can be used by non-web applications to
store data.
 XML files can be transformed into other types of documents. Transformation is
controlled using XSL style sheets. (XSL stands for Extensible Style Language). XSL
style sheets can reorder documents, display or hide information, or apply formatting,
among many other things. XSL uses patterns and logical operations to determine which
parts of a document tree it should transform. XSL works somewhat like a programming
language—it can test for equality and perform processing based upon the results of a
7. How does a packet switching work?
Ans: Packet switching is a method of communicating information, as contrasted to circuit

->Packet switching entails breaking data into a number of parts that are then packaged in
specially formatted units called packets. These are typically routed from source to destination
using network switches and routers and then the data is reassembled at the destination.

->Each packet contains address information that identifies the sending computer and intended
recipient. Using these addresses, network switches and routers determine how best to transfer
the packet between "hops" on the path to its destination. There are free apps like Wireshark to
help you capture and view the data if necessary.

->Packet-switched describes the type of network in which relatively small units of data
called packets are routed through a network based on the destination address contained within
each packet.
-> Breaking communication down into packets allows the same data path to be shared among
many users in the network.
->This type of communication between sender and receiver is known as connectionless (rather
than dedicated). Most traffic over the Internet uses packet switching and the Internet is basically
a connectionless network.

----------100% Efforts 0% expectation---------