SlideShare a Scribd company logo
IADCS Diploma Course Java Network Programming U Nyein Oo COO/Director(IT) Myanma Computer Co., Ltd
Objectives Introduction to Internet and its working Network Protocol TCP and UDP Explain Client/Server computing  Classes of  java.net  package:  InetAddress Socket ServerSocket DatagramSocket DatagramPacket
Objectives(cont) Explain Web related classes: URL Class   URLConnection Class   URLEncoder Class   ContentHandler Class
Networking and Internet Networking is the concept of connecting two machines Internet is nothing but many computers communicating with each other using protocols
Protocol Protocols help in passing information from one computer to another   Computers communicate with each other by exchanging packets of data  Internet Protocol (IP) is the network protocol used to send information from one computer to another over the Internet
Protocol (Contd…) The communication of computers is possible using Ports   Commonly used port numbers  Port No Protocol Description 21 FTP File Transfer Protocol 23 TELNET Remote Login 25 SMTP Simple Mail Transfer Protocol
TCP and UDP Communication takes place with the help of transport protocols TCP establishes link between the source port’s IP address and destination port’s IP address
TCP and UDP (Contd…) UDP is a connectionless protocol as it does not establish a link for the connection   When UDP is used, the destination port and IP addresses are written down in a datagram and the datagram is sent to the destination  UDP   is less reliable as compared to TCP since there is no delivery assurance
Client Server Computing The Net provides a variety of services; these services are organized according to the client/server architecture The client programs like browsers create connections to server programs such as Web and FTP servers
Client Server Computing (Contd…) The client makes the request to the server and the server responds by providing the required service to the client Clients communicate through client sockets and servers communicate through server sockets
Inside java.net The  java.net  package provides the classes that support socket-based client/server communication   Classes of   java.net package:  InetAddress Socket ServerSocket DatagramSocket DatagramPacket
InetAddress Class   This class eases finding of addresses on the Internet   Only the name needs to be supplied to get the respective address It supports both numeric IP address and hostnames
Socket Class Java programs connect to the network using a socket Socket helps in establishing connections and developing applications between the client and server
ServerSocket Class The TCP server socket is implemented using the ServerSocket class   The server socket is made to listen using the  accept( )  method and thereby wait till an incoming connection is established   The address of the host to which the socket is connected is returned using  getInetAddress( )  method
DatagramSocket Class   This class is used to implement the client and server sockets using the  User Datagram Protocol  (UDP) UDP is a connectionless protocol that enables client and server to exchange information using datagrams   Datagrams are nothing but chunks of data   The datagrams are sent and received using the  send( )  and  receive( )  methods respectively
DatagramPacket Class   This class encapsulates the datagrams that are sent and received using objects of DatagramSocket   class There are two different constructors, one for datagrams that are received from the datagram socket and the other for creating datagrams that are sent over the datagram socket
Web related classes While working with the Internet and World Wide Web, we need to create and manipulate URLs The  java.net  package also provides a set of classes that support Web-specific applications  java.net  web-related classes: URL URLConnection URLEncoder  ContentHandler
URL Class   URL stands for  Uniform Resource Locator   It provides a uniform way to locate resources on the web The class  java.net.URL  encapsulates the object on the web
URLConnection   Class   It is an abstract class   If we have an active HTTP connection to the web, the URLConnection class encapsulates it This class supports several methods so as to modify the defaults, query and modify the current settings for a URLConnection object  URLConnection class is used for getting information about the web object and the connection to the web object so as to interact with the web object HttpURLConnection  is a subclass of the URLConnection class
URLEncoder Class   This class is basically used for converting text strings to a suitable form useable as part of an URL   This class provides method called  encode( )  that converts the spaces in the text to plus sign (+)  It uses a percent character (%) as an escape code for encoding special characters
ContentHandler Class   ContentHandler class is used to process and extract data with  MIME (Multipurpose Internet Mail Extension)  types   MIME includes different types of objects such as sounds, images, videos, etc.   It provides viewers to process MIME types

More Related Content

What's hot (20)

Networking in Java
Networking in JavaNetworking in Java
Networking in Java
Tushar B Kute
 
Java Networking
Java NetworkingJava Networking
Java Networking
Sunil OS
 
java networking
 java networking java networking
java networking
Waheed Warraich
 
Chap 1 Network Theory & Java Overview
Chap 1   Network Theory & Java OverviewChap 1   Network Theory & Java Overview
Chap 1 Network Theory & Java Overview
Ministry of Higher Education
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in Java
Tushar B Kute
 
Network Programming in Java
Network Programming in JavaNetwork Programming in Java
Network Programming in Java
Tushar B Kute
 
28 networking
28  networking28  networking
28 networking
Ravindra Rathore
 
Java networking
Java networkingJava networking
Java networking
ssuser3a47cb
 
Socket Programming - nitish nagar
Socket Programming - nitish nagarSocket Programming - nitish nagar
Socket Programming - nitish nagar
Nitish Nagar
 
Md13 networking
Md13 networkingMd13 networking
Md13 networking
Rakesh Madugula
 
Basic Networking in Java
Basic Networking in JavaBasic Networking in Java
Basic Networking in Java
suraj pandey
 
Module 1 networking basics-2
Module 1   networking basics-2Module 1   networking basics-2
Module 1 networking basics-2
Ankit Dubey
 
Java 1
Java 1Java 1
Java 1
VidyaVarshini3
 
Socket Programming
Socket ProgrammingSocket Programming
Socket Programming
CEC Landran
 
Chapter 2 : Inet Address & Data Stream
Chapter 2 : Inet Address & Data StreamChapter 2 : Inet Address & Data Stream
Chapter 2 : Inet Address & Data Stream
Ministry of Higher Education
 
Python Sockets
Python SocketsPython Sockets
Python Sockets
pythontic
 
Java Network Programming 1197644949195966 4
Java Network Programming 1197644949195966 4Java Network Programming 1197644949195966 4
Java Network Programming 1197644949195966 4
chendi.bhargavi
 
Simple chat room using python
Simple chat room using pythonSimple chat room using python
Simple chat room using python
VISHAL VERMA
 
Chapter 2.1 : Data Stream
Chapter 2.1 : Data StreamChapter 2.1 : Data Stream
Chapter 2.1 : Data Stream
Ministry of Higher Education
 
Socket programming-in-python
Socket programming-in-pythonSocket programming-in-python
Socket programming-in-python
Yuvaraja Ravi
 
Networking in Java
Networking in JavaNetworking in Java
Networking in Java
Tushar B Kute
 
Java Networking
Java NetworkingJava Networking
Java Networking
Sunil OS
 
Network programming in Java
Network programming in JavaNetwork programming in Java
Network programming in Java
Tushar B Kute
 
Network Programming in Java
Network Programming in JavaNetwork Programming in Java
Network Programming in Java
Tushar B Kute
 
Java networking
Java networkingJava networking
Java networking
ssuser3a47cb
 
Socket Programming - nitish nagar
Socket Programming - nitish nagarSocket Programming - nitish nagar
Socket Programming - nitish nagar
Nitish Nagar
 
Basic Networking in Java
Basic Networking in JavaBasic Networking in Java
Basic Networking in Java
suraj pandey
 
Module 1 networking basics-2
Module 1   networking basics-2Module 1   networking basics-2
Module 1 networking basics-2
Ankit Dubey
 
Socket Programming
Socket ProgrammingSocket Programming
Socket Programming
CEC Landran
 
Python Sockets
Python SocketsPython Sockets
Python Sockets
pythontic
 
Java Network Programming 1197644949195966 4
Java Network Programming 1197644949195966 4Java Network Programming 1197644949195966 4
Java Network Programming 1197644949195966 4
chendi.bhargavi
 
Simple chat room using python
Simple chat room using pythonSimple chat room using python
Simple chat room using python
VISHAL VERMA
 
Socket programming-in-python
Socket programming-in-pythonSocket programming-in-python
Socket programming-in-python
Yuvaraja Ravi
 

Similar to Java Network Programming (20)

Networking
NetworkingNetworking
Networking
Tuan Ngo
 
Networking
NetworkingNetworking
Networking
Jafar Nesargi
 
Networking in java, Advanced programming
Networking in java, Advanced programmingNetworking in java, Advanced programming
Networking in java, Advanced programming
Gera Paulos
 
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriyaIPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
VijiPriya Jeyamani
 
Java seminar.pptx
Java seminar.pptxJava seminar.pptx
Java seminar.pptx
shirindigitel
 
chapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhjchapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhj
AmitDeshai
 
Networking Basics1ofjavaprogramming.pptx.pdf
Networking Basics1ofjavaprogramming.pptx.pdfNetworking Basics1ofjavaprogramming.pptx.pdf
Networking Basics1ofjavaprogramming.pptx.pdf
omkarthombare4989
 
Unit 6 - Netwohhhhhddddrking in Java.pdf
Unit 6 - Netwohhhhhddddrking in Java.pdfUnit 6 - Netwohhhhhddddrking in Java.pdf
Unit 6 - Netwohhhhhddddrking in Java.pdf
kassyemariyam21
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket Programming
Mousmi Pawar
 
Ajp notes-chapter-04
Ajp notes-chapter-04Ajp notes-chapter-04
Ajp notes-chapter-04
Ankit Dubey
 
Java socket programming
Java socket programmingJava socket programming
Java socket programming
Mohammed Abdalla Youssif
 
Session 6
Session 6Session 6
Session 6
Parthipan Parthi
 
Distributed Computing - API for Internet Protocols
Distributed Computing - API for Internet ProtocolsDistributed Computing - API for Internet Protocols
Distributed Computing - API for Internet Protocols
nirmalanr2
 
5_6278455688045789623.pptx
5_6278455688045789623.pptx5_6278455688045789623.pptx
5_6278455688045789623.pptx
EliasPetros
 
Unit-4 networking basics in java
Unit-4 networking basics in javaUnit-4 networking basics in java
Unit-4 networking basics in java
Amol Gaikwad
 
Unit8 java
Unit8 javaUnit8 java
Unit8 java
mrecedu
 
Unit 8 Java
Unit 8 JavaUnit 8 Java
Unit 8 Java
arnold 7490
 
Unit-6-java basic for java programing.pptx
Unit-6-java basic for java programing.pptxUnit-6-java basic for java programing.pptx
Unit-6-java basic for java programing.pptx
086ChintanPatel1
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
Ebisa Bekele
 
A.java
A.javaA.java
A.java
JahnaviBhagat
 
Networking
NetworkingNetworking
Networking
Tuan Ngo
 
Networking in java, Advanced programming
Networking in java, Advanced programmingNetworking in java, Advanced programming
Networking in java, Advanced programming
Gera Paulos
 
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriyaIPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
VijiPriya Jeyamani
 
Java seminar.pptx
Java seminar.pptxJava seminar.pptx
Java seminar.pptx
shirindigitel
 
chapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhjchapter-4-networking hjgjjgj did hfhhfhj
chapter-4-networking hjgjjgj did hfhhfhj
AmitDeshai
 
Networking Basics1ofjavaprogramming.pptx.pdf
Networking Basics1ofjavaprogramming.pptx.pdfNetworking Basics1ofjavaprogramming.pptx.pdf
Networking Basics1ofjavaprogramming.pptx.pdf
omkarthombare4989
 
Unit 6 - Netwohhhhhddddrking in Java.pdf
Unit 6 - Netwohhhhhddddrking in Java.pdfUnit 6 - Netwohhhhhddddrking in Java.pdf
Unit 6 - Netwohhhhhddddrking in Java.pdf
kassyemariyam21
 
Networking Java Socket Programming
Networking Java Socket ProgrammingNetworking Java Socket Programming
Networking Java Socket Programming
Mousmi Pawar
 
Ajp notes-chapter-04
Ajp notes-chapter-04Ajp notes-chapter-04
Ajp notes-chapter-04
Ankit Dubey
 
Distributed Computing - API for Internet Protocols
Distributed Computing - API for Internet ProtocolsDistributed Computing - API for Internet Protocols
Distributed Computing - API for Internet Protocols
nirmalanr2
 
5_6278455688045789623.pptx
5_6278455688045789623.pptx5_6278455688045789623.pptx
5_6278455688045789623.pptx
EliasPetros
 
Unit-4 networking basics in java
Unit-4 networking basics in javaUnit-4 networking basics in java
Unit-4 networking basics in java
Amol Gaikwad
 
Unit8 java
Unit8 javaUnit8 java
Unit8 java
mrecedu
 
Unit 8 Java
Unit 8 JavaUnit 8 Java
Unit 8 Java
arnold 7490
 
Unit-6-java basic for java programing.pptx
Unit-6-java basic for java programing.pptxUnit-6-java basic for java programing.pptx
Unit-6-java basic for java programing.pptx
086ChintanPatel1
 
Ad

More from backdoor (20)

Java Database Connectivity
Java Database ConnectivityJava Database Connectivity
Java Database Connectivity
backdoor
 
Distributed Programming using RMI
 Distributed Programming using RMI Distributed Programming using RMI
Distributed Programming using RMI
backdoor
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet
backdoor
 
Distributed Programming using RMI
Distributed Programming using RMIDistributed Programming using RMI
Distributed Programming using RMI
backdoor
 
Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Applet
backdoor
 
Windows Programming with Swing
Windows Programming with SwingWindows Programming with Swing
Windows Programming with Swing
backdoor
 
Windows Programming with AWT
Windows Programming with AWTWindows Programming with AWT
Windows Programming with AWT
backdoor
 
Multithreading
MultithreadingMultithreading
Multithreading
backdoor
 
Object and Classes in Java
Object and Classes in JavaObject and Classes in Java
Object and Classes in Java
backdoor
 
IO and serialization
IO and serializationIO and serialization
IO and serialization
backdoor
 
Exception Handling
Exception HandlingException Handling
Exception Handling
backdoor
 
Java Intro
Java IntroJava Intro
Java Intro
backdoor
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
backdoor
 
AWT Program output
AWT Program outputAWT Program output
AWT Program output
backdoor
 
Net Man
Net ManNet Man
Net Man
backdoor
 
Data Security
Data SecurityData Security
Data Security
backdoor
 
Ne Course Part One
Ne Course Part OneNe Course Part One
Ne Course Part One
backdoor
 
Ne Course Part Two
Ne Course Part TwoNe Course Part Two
Ne Course Part Two
backdoor
 
Net Sec
Net SecNet Sec
Net Sec
backdoor
 
Security Policy Checklist
Security Policy ChecklistSecurity Policy Checklist
Security Policy Checklist
backdoor
 
Java Database Connectivity
Java Database ConnectivityJava Database Connectivity
Java Database Connectivity
backdoor
 
Distributed Programming using RMI
 Distributed Programming using RMI Distributed Programming using RMI
Distributed Programming using RMI
backdoor
 
Programming Server side with Sevlet
 Programming Server side with Sevlet  Programming Server side with Sevlet
Programming Server side with Sevlet
backdoor
 
Distributed Programming using RMI
Distributed Programming using RMIDistributed Programming using RMI
Distributed Programming using RMI
backdoor
 
Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Applet
backdoor
 
Windows Programming with Swing
Windows Programming with SwingWindows Programming with Swing
Windows Programming with Swing
backdoor
 
Windows Programming with AWT
Windows Programming with AWTWindows Programming with AWT
Windows Programming with AWT
backdoor
 
Multithreading
MultithreadingMultithreading
Multithreading
backdoor
 
Object and Classes in Java
Object and Classes in JavaObject and Classes in Java
Object and Classes in Java
backdoor
 
IO and serialization
IO and serializationIO and serialization
IO and serialization
backdoor
 
Exception Handling
Exception HandlingException Handling
Exception Handling
backdoor
 
Java Intro
Java IntroJava Intro
Java Intro
backdoor
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
backdoor
 
AWT Program output
AWT Program outputAWT Program output
AWT Program output
backdoor
 
Net Man
Net ManNet Man
Net Man
backdoor
 
Data Security
Data SecurityData Security
Data Security
backdoor
 
Ne Course Part One
Ne Course Part OneNe Course Part One
Ne Course Part One
backdoor
 
Ne Course Part Two
Ne Course Part TwoNe Course Part Two
Ne Course Part Two
backdoor
 
Net Sec
Net SecNet Sec
Net Sec
backdoor
 
Security Policy Checklist
Security Policy ChecklistSecurity Policy Checklist
Security Policy Checklist
backdoor
 
Ad

Recently uploaded (20)

Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
Cisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdfCisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdf
superdpz
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025
Suyash Joshi
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
Can We Use Rust to Develop Extensions for PostgreSQL? (POSETTE: An Event for ...
NTT DATA Technology & Innovation
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
Cisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdfCisco ISE Performance, Scalability and Best Practices.pdf
Cisco ISE Performance, Scalability and Best Practices.pdf
superdpz
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025
Suyash Joshi
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 

Java Network Programming

  • 1. IADCS Diploma Course Java Network Programming U Nyein Oo COO/Director(IT) Myanma Computer Co., Ltd
  • 2. Objectives Introduction to Internet and its working Network Protocol TCP and UDP Explain Client/Server computing Classes of java.net package: InetAddress Socket ServerSocket DatagramSocket DatagramPacket
  • 3. Objectives(cont) Explain Web related classes: URL Class URLConnection Class URLEncoder Class ContentHandler Class
  • 4. Networking and Internet Networking is the concept of connecting two machines Internet is nothing but many computers communicating with each other using protocols
  • 5. Protocol Protocols help in passing information from one computer to another Computers communicate with each other by exchanging packets of data Internet Protocol (IP) is the network protocol used to send information from one computer to another over the Internet
  • 6. Protocol (Contd…) The communication of computers is possible using Ports Commonly used port numbers Port No Protocol Description 21 FTP File Transfer Protocol 23 TELNET Remote Login 25 SMTP Simple Mail Transfer Protocol
  • 7. TCP and UDP Communication takes place with the help of transport protocols TCP establishes link between the source port’s IP address and destination port’s IP address
  • 8. TCP and UDP (Contd…) UDP is a connectionless protocol as it does not establish a link for the connection When UDP is used, the destination port and IP addresses are written down in a datagram and the datagram is sent to the destination UDP is less reliable as compared to TCP since there is no delivery assurance
  • 9. Client Server Computing The Net provides a variety of services; these services are organized according to the client/server architecture The client programs like browsers create connections to server programs such as Web and FTP servers
  • 10. Client Server Computing (Contd…) The client makes the request to the server and the server responds by providing the required service to the client Clients communicate through client sockets and servers communicate through server sockets
  • 11. Inside java.net The java.net package provides the classes that support socket-based client/server communication Classes of java.net package: InetAddress Socket ServerSocket DatagramSocket DatagramPacket
  • 12. InetAddress Class This class eases finding of addresses on the Internet Only the name needs to be supplied to get the respective address It supports both numeric IP address and hostnames
  • 13. Socket Class Java programs connect to the network using a socket Socket helps in establishing connections and developing applications between the client and server
  • 14. ServerSocket Class The TCP server socket is implemented using the ServerSocket class The server socket is made to listen using the accept( ) method and thereby wait till an incoming connection is established The address of the host to which the socket is connected is returned using getInetAddress( ) method
  • 15. DatagramSocket Class This class is used to implement the client and server sockets using the User Datagram Protocol (UDP) UDP is a connectionless protocol that enables client and server to exchange information using datagrams Datagrams are nothing but chunks of data The datagrams are sent and received using the send( ) and receive( ) methods respectively
  • 16. DatagramPacket Class This class encapsulates the datagrams that are sent and received using objects of DatagramSocket class There are two different constructors, one for datagrams that are received from the datagram socket and the other for creating datagrams that are sent over the datagram socket
  • 17. Web related classes While working with the Internet and World Wide Web, we need to create and manipulate URLs The java.net package also provides a set of classes that support Web-specific applications  java.net web-related classes: URL URLConnection URLEncoder ContentHandler
  • 18. URL Class URL stands for Uniform Resource Locator It provides a uniform way to locate resources on the web The class java.net.URL encapsulates the object on the web
  • 19. URLConnection Class It is an abstract class If we have an active HTTP connection to the web, the URLConnection class encapsulates it This class supports several methods so as to modify the defaults, query and modify the current settings for a URLConnection object URLConnection class is used for getting information about the web object and the connection to the web object so as to interact with the web object HttpURLConnection is a subclass of the URLConnection class
  • 20. URLEncoder Class This class is basically used for converting text strings to a suitable form useable as part of an URL This class provides method called encode( ) that converts the spaces in the text to plus sign (+) It uses a percent character (%) as an escape code for encoding special characters
  • 21. ContentHandler Class ContentHandler class is used to process and extract data with MIME (Multipurpose Internet Mail Extension) types MIME includes different types of objects such as sounds, images, videos, etc. It provides viewers to process MIME types