The document discusses Java networking, including classes like ServerSocket and InetAddress, and provides example programs for server-client communication. It defines networking, its advantages, and key terms such as web browser, web server, protocol, and HTTP. Additionally, it outlines the differences between TCP and UDP and explains the HTTP communication process between clients and servers.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
16 views8 pages
Networking in Java Important Questions
The document discusses Java networking, including classes like ServerSocket and InetAddress, and provides example programs for server-client communication. It defines networking, its advantages, and key terms such as web browser, web server, protocol, and HTTP. Additionally, it outlines the differences between TCP and UDP and explains the HTTP communication process between clients and servers.
i) Define networking? ii) Any 2 advantages of networking. 1) Networking: Networking, also known as computer networking, is the practice of transporting and exchanging data between nodes over a shared medium in an information system. Computer networking enables devices and endpoints to be connected to each other on a local area network (LAN) or to a larger network, such as the internet or a private wide area network (WAN). This is an essential function for service providers, businesses and consumers worldwide to share resources, use or offer services, and communicate. Advantages (Any 2)
Sharing devices such as printers saves money.
Site (software) licences are likely to be cheaper than buying several standalone licences. Files can easily be shared between users. Network users can communicate by email and instant messenger. Security is good - users cannot see other users' files unlike on stand-alone machines. Data is easy to backup as all the data is stored on the file server.
Define networking. State the advantages of
networking Networking, also known as computer networking, is the practice of transporting and exchanging data between nodes over a shared medium in an information system. Advantages Sharing devices such as printers saves money. Site (software) licences are likely to be cheaper than buying several standalone licences. Files can easily be shared between users. Network users can communicate by email and instant messenger. Security is good - users cannot see other users' files unlike on stand-alone machines. Data is easy to backup as all the data is stored on the file server.
List the classes in java networking and methods of
InetAddress class. Write a program using ServerSocket class
Define terms : a)Web Browser b) Web Server c) Protocol d)HTTP
a) Web browser - A web browser takes you anywhere on the
internet. It retrieves information from other parts of the web and displays it on your desktop or mobile device. The information is transferred using the Hypertext Transfer Protocol, which defines how text, images and video are transmitted on the web.
b) Web Server - Web server is a computer where the web content is
stored. Basically web server is used to host the web sites but there exists other web servers also such as gaming, storage, FTP, email etc. E.g. of web servers are Apache, Nginx, etc.
c) Protocol - In networking, a protocol is a standardized way of
doing certain actions and formatting data so that two or more devices are able to communicate with and understand each other.
d) HTTP - Stands for "Hypertext Transfer Protocol." HTTP is the
protocol used to transfer data over the web. It is part of the Internet protocol suite and defines commands and services used for transmitting webpage data. HTTP uses a server-client model
List the classes in java networking?Explain various
method of DatagramSocket class. Ans: Write a client program communication using Socket class. Ans: Client.java import java.io.*; import java.net.*; public class MyClientProgram { public static void main(String[] args) { try { Socket s=new Socket("localhost",6666); DataOutputStream dout=new DataOutputStream(s.getOutputStream()); dout.writeUTF("Hello Server"); dout.flush(); dout.close(); s.close(); }catch(Exception e){System.out.println(e);} } }
Explain with a suitable diagram the HTTP
communication between Web-Server, and web client. HTTP (Hypertext Transfer Protocol) is the set of rules for transferring files -- such as text, images, sound, video and other multimedia files -- over the web. As soon as a user opens their web browser, they are indirectly using HTTP. HTTP is an application protocol that runs on top of the TCP/IP suite of protocols, which forms the foundation of the internet.Through the HTTP protocol, resources are exchanged between client devices and servers over the internet. Client devices send requests to servers for the resources needed to load a web page; the servers send responses back to the client to fulfill the requests. Requests and responses share sub-documents -- such as data on images, text, text layouts, etc. -- which are pieced together by a client web browser to display the full web page file.
There are three fundamental features
that make the HTTP a simple and powerful protocol used for communication:
o HTTP is media independent: It
specifies that any type of media content can be sent by HTTP as long as both the server and the client can handle the data content. o HTTP is connectionless: It is a connectionless approach in which HTTP client i.e., a browser initiates the HTTP request and after the request is sent the client disconnects from server and waits for the response. o HTTP is stateless: The client and server are aware of each other during a current request only. Afterwards, both of them forget each other. Due to the stateless nature of protocol, neither the client nor the server can retain the information about different request across the web pages. Explain URL class.