Google News
logo
Java Networking
Introduction to networking :
1) The process of connecting the resources (computers) together to share the data is called networking. 

2) Java.net is package it contains number of classes by using that classes we are able to connection between the devices (computers) to share the information. 

3) Java.net package provide support for the TCP (Transmission Control Protocol),UDP(user data gram protocol) protocols. 

4) In the network we are having to components
a. Sender
b. Receiver
Sender/source: - the person who is sending the data is called sender.
Receiver/destination:- the person who is receiving the data is called receiver.
In the network one system can acts as a sender as well as receiver. 

5) In the networking terminology everyone says client and server.
I. Client
II. Server 

Client: the person who is sending the request and taking the response is called client. 

Server: the person who is taking the request and sending the response is called server.
Categories of network :
We are having two types of networks
1) Per-to-peer network.
2) Client-server network. 

Client-server:
In the client server architecture always client system behaves as a client and server system behaves as a server.
Peer-to-peer :
In the peer to peer client system sometimes behaves as a server, server system sometimes behaves like a client the roles are not fixed. 

Types of networks :
Intranet: 
It is also known as a private network. To share the information in limited area range(within the organization) then we should go for intranet.
Internet:
It is also known as public networks. Where the data maintained in a centralized server hence we are having more sharability. And we can access the data from anywhere else.
Extranet:
This is extension to the private network means other than the organization , authorized persons able to access. 

The frequently used terms in the networking:-
1) IP Address
2) URL(Uniform Resource Locator)
3) Protocol
4) Port Number
5) MAC address.
6) Connection oriented and connection less protocol
7) Socket.

Protocol: 
Protocol is a set of rules fallowed by the every computer present in the network this is useful to send the data physically from one place to another place in the network.
TCP(Transmission Control Protocol)(connection oriented protocol)
UDP (User Data Gram Protocol)(connection less protocol)
Telnet
SMTP(Simple Mail Transfer Protocol)
IP (Internet Protocol) 

IP Address:
1) IP Address is a unique identification number given to the computer to indentify it uniquely in the network.
2) The IP Address is uniquely assigned to the computer it is not duplicated.
3) The IP Address range is 0-255 if we are giving the other than this range that is not allowed.
4) We can identify the particular computer in the network with the help of IP Address.
5) The IP Address contains four digit number
a. 125.0.4.255----good
b. 124.654.5.6-----bad
c. 1.2.3.4.5.6-------bad
6) Each and every website contains its own IP Address we can access the sites through the names otherwise IP Address.
Site Name :- www.google.com
IP Address :- 74.125.224.72
get web site ip address
import java.util.*; 
import java.net.*; 
import java.io.*; 
class Test 
{ 
public static void main(String[] args) throws Exception 
{ 
BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); 
System.out.println("please enter site name"); 
String sitename=br.readLine(); 
InetAddress in=InetAddress.getByName(sitename); 
System.out.println("the ip address is:"+in); 
} 
}
Output :
please enter site name
freetmielearn.com
the ip address is:freetmielearn.com/42.37.204.61