Java Networking

Java Networking is a concept of connecting two or more computing devices together so that we can share resources.

Java socket programming provides facility to share data between different computing devices.

Advantage of Java Networking

  1. sharing resources
  2. centralize software management

Do You Know ?

  • How to perform connection-oriented Socket Programming in networking ?
  • How to display the data of any online web page ?
  • How to get the IP address of any host name e.g. www.google.com ?
  • How to perform connection-less socket programming in networking ?

Java Networking Terminology

The widely used java networking terminologies are given below:

  1. IP Address
  2. Protocol
  3. Port Number
  4. MAC Address
  5. Connection-oriented and connection-less protocol
  6. Socket
IP Address

IP address is a unique number assigned to a node of a network e.g. 192.168.0.1 . It is composed of octets that range from 0 to 255.

It is a logical address that can be changed.

Protocol

A protocol is a set of rules basically that is followed for communication. For example:

  • TCP
  • FTP
  • Telnet
  • SMTP
  • POP etc.
Port Number

The port number is used to uniquely identify different applications. It acts as a communication endpoint between applications.

The port number is associated with the IP address for communication between two applications.

MAC Address

MAC (Media Access Control) Address is a unique identifier of NIC (Network Interface Controller). A network node can have multiple NIC but each with unique MAC.

Connection-oriented and connection-less protocol

In connection-oriented protocol, acknowledgement is sent by the receiver. So it is reliable but slow. The example of connection-oriented protocol is TCP.

But, in connection-less protocol, acknowledgement is not sent by the receiver. So it is not reliable but fast. The example of connection-less protocol is UDP.

Socket

A socket is an endpoint between two way communication.

Visit next page for java socket programming.

java.net package

The java.net package provides many classes to deal with networking applications in Java. A list of these classes is given below:

  • Authenticator
  • CacheRequest
  • CacheResponse
  • ContentHandler
  • CookieHandler
  • CookieManager
  • DatagramPacket
  • DatagramSocket
  • DatagramSocketImpl
  • InterfaceAddress
  • JarURLConnection
  • MulticastSocket
  • InetSocketAddress
  • InetAddress
  • Inet4Address
  • Inet6Address
  • IDN
  • HttpURLConnection
  • HttpCookie
  • NetPermission
  • NetworkInterface
  • PasswordAuthentication
  • Proxy
  • ProxySelector
  • ResponseCache
  • SecureCacheResponse
  • ServerSocket
  • Socket
  • SocketAddress
  • SocketImpl
  • SocketPermission
  • StandardSocketOptions
  • URI
  • URL
  • URLClassLoader
  • URLConnection
  • URLDecoder
  • URLEncoder
  • URLStreamHandler

What we will learn in Networking Tutorial

  • Networking and Networking Terminology
  • Socket Programming (Connection-oriented)
  • URL class
  • Displaying data of a webpage by URLConnection class
  • InetAddress class
  • DatagramSocket and DatagramPacket (Connection-less)
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +