0% found this document useful (0 votes)
6 views7 pages

Networking Java Presentation

The document provides an overview of networking in Java, highlighting the use of the java.net package for TCP and UDP communication. It explains key concepts such as IP addresses, port numbers, and the main classes used for network programming. Additionally, it outlines the steps for implementing TCP and UDP programming in Java, along with example programs.

Uploaded by

Suresh Pant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views7 pages

Networking Java Presentation

The document provides an overview of networking in Java, highlighting the use of the java.net package for TCP and UDP communication. It explains key concepts such as IP addresses, port numbers, and the main classes used for network programming. Additionally, it outlines the steps for implementing TCP and UDP programming in Java, along with example programs.

Uploaded by

Suresh Pant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Networking in Java

Overview and Key Programming


Concepts
Introduction to Networking
• Networking allows communication between
computers.
• Java provides the java.net package for
network programming.
• It supports both TCP and UDP protocols.
Networking Basics
• - IP Address: Unique address of a device on
the network
• - Port Number: Identifies a specific process or
service
• - Protocols: TCP (connection-based), UDP
(connectionless)
java.net Package
• Key classes in java.net package:
• - InetAddress: Handles IP addresses
• - Socket: Client-side socket
• - ServerSocket: Server-side socket
• - DatagramSocket & DatagramPacket: Used for
UDP communication
TCP Programming in Java
• Steps:
• 1. Server creates ServerSocket and waits for
client
• 2. Client creates Socket and connects to server
• 3. Use InputStream/OutputStream for
communication
• 4. Close connections
UDP Programming in Java
• Steps:
• 1. Create DatagramSocket
• 2. Create DatagramPacket to send/receive
data
• 3. Send/Receive data
• 4. Close socket

• UDP is faster but does not guarantee delivery.


Example Programs
• - TCP Client/Server Chat
• - UDP Echo Program
• - IP address fetch using InetAddress

You might also like