Java Networking
Network is nothing but a set of computers which are physically connected together.internet is a network of networks.
Protocols:
Different networks requires certain set of rules called protocols.java networking is done using TCP/IP protocol
Different types of protocols are also available in this protocol they are:
*Http(Hyper Text Transfer Protocol)
*FTP(File Transfer Protocol)
*SMTP(Simple Mail Transfer Protocol)
*NNTP(Network News Transfer Protocol)
Sockets:
Sockets is used to plug in just like a electronic sockets.it is essential that they should follow a set of rules to communicate called protocols.
TCP/IP as protocol for communication and IP addresses are the address of the sockets.
Client/Server:
A computer request some service from another computer,is called a client.one that processes the request is called server.A server waits till one of its clients makes a request.it can accept multiple connections at a time.Multi-threading is used to serve multiple users at the same time.
Internet Addresses:
Every computer are connected to a network has a unique IP address.An IP address is a 32-bit number which has four numbers separate by periods.it is possible to connect to the Internet either directly or by using internet service provider.By connecting directly to the internet,the computer is assigned with a permanent IP address.
InetAddress:
InetAddress is one class,which is used to encapsulate th IP address and the DNS.to create a instance of InetAddress class,factory methods are used as there are no visible constructors available for this class.
Methods:
static InetAddress getLocalHost() //Returns InetAddress object representing local host
static InetAddress getByName(String hostname) //Returns InetAddress for the host passed to it.
Popularity: 2% [?]