Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Java Thread Network Overview of Networking through JAVA

Related Tutorials


 
 

Share on Google+Share on Google+

Overview of Networking through JAVA

Advertisement
This page discusses - Overview of Networking through JAVA

Overview of Networking through JAVA

     

The Java platform is extremely preferable to write an application program require to communicate with the resources on network. Java, mainly focuses on the networking relating the description of the networking capabilities of the Java platform and second one is describes a brief summary of networking in a very simple manner that how to use URLs, sockets, and datagrams.

In Java, there is a java.net package provides the network support. All the classes for making a network program are define in the java.net package. Through TCP we can communicate over the network.

Java networking 

  • Computer Networking
    Here we are going to unfold the concepts of networking in day to day scenarios. Let us consider that you started a commercial activity where you were using a computer along with a printer, modem and a CD-ROM. 
      
  • Client-Server Architecture
    Client-server architecture can be considered as a network environment that exchanges information between a server machine  and a client machine where server has some resources that can be shared by different clients.
     
  • Socket and ports
    In common language we can say that the socket is one of the most primal technologies of computer networking. Sockets are just like an end-point of two-way communication, which allow applications to communicate using network hardware and operating systems.
  • Server Sockets
    In common language we can say that the sockets are just like an end-point of two-way communication link over the network between two programs. Socket classes are used to establish a connection between client program and a server program.
      
  • URL in term of Java Network Programming
    A URL (Uniform Resource Locator) is the address of a resource on the Internet. In java network programming we can use URLs to connect and retrieve information over the Internet.
      
  • Datagrams in network environment
    In a network environment the client and the server communicate with each-other by reliable channel like TCP socket which have dedicated point-to-point channel between client and server. All data sent over the channel is received and sent in the same order. 
       
  • Networking in java
    In this section we are exploring the java.net package which provides the support for networking in java with a generic style. All the java classes for developing a network program are defined in the java.net package. 

   
Getting Hands-on Java  Networking example
 

  1. Find Your Host Name/IP Address
    In this section you will learn about the getLocalHost() method to print the Host name as well as the IP Address of the local system. For do for the same we have to call InetAddress class then we need to create a object, in which we store the local host information.
            

  2. Find Your Host Name
    Here we are going to explore a method to retrieve the host name of the local system in a very simple example. Here we are just call the InetAddress class and after made a object of that class we call a getLocalHost() method and pass it in the object.
          

  3. Getting list of Local Interfaces on a machine
    Here we are going to explain the method to find out the total no of list of local interfaces available on a machine. Here we are give a complete example named URLDemo.java.
          

  4. Getting the Local port
    In this section you will learn that how a user can access the Local port. Here we are going to make it easier to understand the step be step process by the complete example on this topic.
           

  5. Find the Host name in reverse of given IP address
    In this section you will learn to retrieve the information about the local host name using the getHostName() method. Here is an example that provides the usage of the getHostName() method in more detail.
         

  6. How to retrieve URL information
    Here we are going to explain a method for retrieve all the network information for a given URL. In the given below example we use the URL class and make a object.
         

  7. Convert URI to URL
    Here we are going to explain the method to change Uniform Resource Identifier (URI) reference to uniform resource locator (URL). Here we are give a complete example named "ConvertURItoURL.java". 
           

  8. To retrieve the IP address from Host Name, vice-versa
    Here we are going to explain the method to find out the IP address from host name and to vice verse. Here we are give a complete example named HostLookup.java. In which we call a InetAddress and make a object and pass the input value in it.
         

  9. Construct a DatagramPacket to receive data
    In this section we provide a complete code of a example based on the method DatagramPacket(buffer, buffer.length) for constructs a DatagramPacket for receiving packets of length length in more generic way.
          

  10. Construct a DatagramSocket on an unspecified port
    In this section we are going to explain the process to construct a DatagramPacket object in more generic way. Here we provide a complete example based on the method for creating the DatagramSocket object via DatagramSocket().
         

  11. Return the MIME Header
    In this section you will learn about the method to retrieve the MIME header. MIME is stands for Multipurpose Internet Mail Extensions which is an Internet Standard that extends the format of e-mail to support. A container for MimeHeader objects, which represent the MIME headers that is present in a MIME part of data.
         

  12. Open a URLConnection to specific website address
    Here we are going to establish a connection to a specific web address via a complete example. In the example we create a class getURLConnection and initialize a variable of url to URL and ucon of URLConnection.

       

  13. Print the URL of a URLConnection
    In this section we are going to describe, how to retrieve the value of the URL assign to the url object. Here is the complete code of the program in which first of all we establish a connection then display it.


 

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 17, 2011

Related Tutorials

Discuss: Overview of Networking through JAVA  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com