Login Here                        

Uniform Resource Locator

1) URL is a class present in the package.
2) By using the URL we are accessing some information present in the world wide web.
3) Example of URL is:-
The URL contains information like
a. Protocol to use http://
b. Server name/IP address
c. Port number of the particular application and it is optional(:10)
d. File name or directory name networking.php
4) To crate the object for URL we have to use the fallowing syntax
a. URL obj=new URL(String protocol, String host, int port, String path);
b. URL obj=new URL(String protocol, String host, String path);

URL program

import java.util.*;
class Test
public static void main(String[] args) throws Exception
URL url=new URL("");
System.out.println("protocal is:"+url.getProtocol());
System.out.println("host name is:"+url.getHost());
System.out.println("port number is:"+url.getPort());
System.out.println("path is:"+url.getPath());

intput and output

protocal is:http
host name
port number is:10
path is:/index.php

Communication using networking :-

In the networking it is possible to do two types of communications.
1) Connection oriented(TCP/IP communication)
2) Connection less(UDP Communication)

Connection Oriented:-

a) In this type of communication we are using combination of two protocols TCP,IP.
b) In this type of communication the main purpose of the TCP is transferred in the form of packets between the source and destination. And the main purpose of the IP is finding address of a particular system.
To achieve the fallowing communication the java peoples are provided the fallowing classes.
   a. Socket
   b. ServerSocket

Application Layer:-

Takes the data from the application and sends it to the TCP layer.
TCP Protocol:-
it will take the data which is coming from Application Layer and divides in to small units called Packets. Then transfer those packets to the next layer called IP. The packet contains group of bytes of data.
It will take the packets which is coming from TCP and prepare envelop called ‘frames’ hence the frame contains the group of packets. Then it will identify the particular target machine on the basis of the IP address and sent that frames to the physical layer.
Physical Layer:-
Based on the physical medium it will transfer the data to the target machine.

Connection Less :- (UDP)

1) UDP is a protocol by using this protocol we are able to send data without using Physical Connection.
2) This is a light weight protocol because no need of the connection between the client and server .
3) This is very fast communication compare to the TCP/IP communication.
4) This protocol not sending the data inn proper order there may be chance of missing the data.
5) This communication used to send the Audio and Video data if some bits are lost but we are able to see the video and images we are getting any problems.
To achieve the UDP communication the java peoples are provided the fallowing classes.
1. DataGrampacket.
2. DataGramSocket.