Java Networking

Java Networking – Network Basics and Socket Overview

Java Networking is a set of classes and APIs provided by the Java platform to facilitate network communication and programming. It allows developers to create networked applications that can communicate over various network protocols, such as TCP/IP and UDP. Let’s explore the network basics and socket overview in the context of Java programming: Network Programming […]

Java Networking – inetAddress

In Java, InetAddress is a class that represents an IP address and provides methods to work with IP addresses and hostnames. It is part of the java.net package and is used in network programming for tasks such as resolving hostnames, retrieving IP addresses, and performing network-related operations. Here’s an overview of InetAddress in Java networking […]

Java Networking – TCP / IP Client – Server Sockets

Lets look at the syntax below Syntax ServerSocket ss; ss=new ServerSocket(Port_No);Example ServerSocket ss = new ServerSocket(80); Lets Look at TCP IP Server Program TCP IP Server Program import java.io.*; import java.net.*; public class MyDemoServer { public static void main(String[] args) { try{ ServerSocket ss = new ServerSocket(80); Socket s=ss.accept();//Establishing Connection DataInputStream dis = new DataInputStream(s.getInputStream()); […]

Java Networking – Datagram Socket and DatagramPacket

Datagrams:DatagramSocket Class DatagramSocket class represents connectionless socket for sending and receiving datagram packets. A Datagram is basically an information but there is no guarantee of its content ,arrival or arrival time. Constructor Method                                           Description DatagramSocket() It creats a datagram socket and bind its with the available port number on the local host machine DatagramSocket(int port) […]

Java Networking – URL Connection Class

URL stands for Uniform Resource locator The Java URL class represents an URL This class is pointer to resource on the world wide web Lets check with an example http://166.62.27.173:8090//myurl.html Here http is the URL 166.62.27.173 is the Server name or IP Address 8090 is the Port Number Myurl.html is file name Constructor URL(String url) […]