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

PPT
Java Network Programming
PPT
Java networking
PPTX
Advance Java-Network Programming
PPT
PPT
Java API: java.net.InetAddress
PPTX
PPT
Remote method invocation
PDF
CS6601 DISTRIBUTED SYSTEMS
Java Network Programming
Java networking
Advance Java-Network Programming
Java API: java.net.InetAddress
Remote method invocation
CS6601 DISTRIBUTED SYSTEMS

What's hot (20)

PPTX
DOC
PDF
PPT
Peer to Peer services and File systems
PPT
Chapter 4 slides
PPT
The Internet and World Wide Web
PPTX
Chapter 4
PPT
Inter-Process Communication (IPC) techniques on Mac OS X
PPT
Application layer protocols
PPT
Application layer protocols
PPTX
Apple continuity
PPTX
Message queuing telemetry transport (mqtt) launch
PPTX
Message queuing telemetry transport (mqtt) topic parameters
PPTX
Unit 3 cs6601 Distributed Systems
PPTX
Message queuing telemetry transport (mqtt)and part 3 and summarizing
PPTX
Web Terminology
PPT
XMPP For Cloud Computing
PDF
Ch1 computer networks internet_encapsulation_4
PDF
Sample ch10 corr-maurer_netty_december03
PPTX
Secure erasure code based distributed storage system with secure data forwarding
Peer to Peer services and File systems
Chapter 4 slides
The Internet and World Wide Web
Chapter 4
Inter-Process Communication (IPC) techniques on Mac OS X
Application layer protocols
Application layer protocols
Apple continuity
Message queuing telemetry transport (mqtt) launch
Message queuing telemetry transport (mqtt) topic parameters
Unit 3 cs6601 Distributed Systems
Message queuing telemetry transport (mqtt)and part 3 and summarizing
Web Terminology
XMPP For Cloud Computing
Ch1 computer networks internet_encapsulation_4
Sample ch10 corr-maurer_netty_december03
Secure erasure code based distributed storage system with secure data forwarding
Ad

Viewers also liked (15)

PDF
aLisa's scribe #2
PPT
UC Nursing CDSDEV 2 Q
PPT
Week 2 Slidecast: Networked Information
PPT
UC Nursing CESDEV 2 I
PPT
UC Nursing CESDEV 3 I
PDF
Egypt & Jordan Calendar2006
PPT
Transition
PPT
Labtec
PPT
KV PP Alumni Feb, 2008
PPS
UC Nursing CESDEV 3 Aa Langob Outreach Ppt Show
PPT
Arson In Korea’S Historical Treasure
PPT
Uncertain Future in Kenya
 
PPT
PresentacióN1
PPT
Mahoney
aLisa's scribe #2
UC Nursing CDSDEV 2 Q
Week 2 Slidecast: Networked Information
UC Nursing CESDEV 2 I
UC Nursing CESDEV 3 I
Egypt & Jordan Calendar2006
Transition
Labtec
KV PP Alumni Feb, 2008
UC Nursing CESDEV 3 Aa Langob Outreach Ppt Show
Arson In Korea’S Historical Treasure
Uncertain Future in Kenya
 
PresentacióN1
Mahoney
Ad

Similar to Java Network Programming 1197644949195966 4 (20)

PPT
Md13 networking
PDF
28 networking
PDF
Networking
PPTX
Networking
PPTX
Java networking
PDF
Networking in java, Advanced programming
PPT
Network programming in Java
PPTX
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
PPT
Network Programming in Java
PPTX
Java seminar.pptx
PPT
chapter-4-networking hjgjjgj did hfhhfhj
PDF
Networking Basics1ofjavaprogramming.pptx.pdf
PDF
Unit 6 - Netwohhhhhddddrking in Java.pdf
PPT
Networking Java Socket Programming
PPTX
Networking in Java
PDF
Ajp notes-chapter-04
PPTX
Java socket programming
PPTX
Session 6
PPT
Network programming in Java
PDF
Java Network Programming Third Edition 3rd Edition Elliotte Rusty Harold
Md13 networking
28 networking
Networking
Networking
Java networking
Networking in java, Advanced programming
Network programming in Java
IPT Chapter 2 Web Services and Middleware - Dr. J. VijiPriya
Network Programming in Java
Java seminar.pptx
chapter-4-networking hjgjjgj did hfhhfhj
Networking Basics1ofjavaprogramming.pptx.pdf
Unit 6 - Netwohhhhhddddrking in Java.pdf
Networking Java Socket Programming
Networking in Java
Ajp notes-chapter-04
Java socket programming
Session 6
Network programming in Java
Java Network Programming Third Edition 3rd Edition Elliotte Rusty Harold

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
A Presentation on Artificial Intelligence
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Cloud computing and distributed systems.
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Electronic commerce courselecture one. Pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
MYSQL Presentation for SQL database connectivity
20250228 LYD VKU AI Blended-Learning.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
A Presentation on Artificial Intelligence
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf
MIND Revenue Release Quarter 2 2025 Press Release
The Rise and Fall of 3GPP – Time for a Sabbatical?
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Network Security Unit 5.pdf for BCA BBA.
Diabetes mellitus diagnosis method based random forest with bat algorithm
Cloud computing and distributed systems.
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Electronic commerce courselecture one. Pdf
Review of recent advances in non-invasive hemoglobin estimation
The AUB Centre for AI in Media Proposal.docx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Spectral efficient network and resource selection model in 5G networks
MYSQL Presentation for SQL database connectivity

Java Network Programming 1197644949195966 4

  • 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