chapter 2 : inet address & data stream
TRANSCRIPT
![Page 1: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/1.jpg)
CHAPTER 2 : Internet Addressing & Data Stream
By :
Mr. Asyran Zarizi Bin Abdullah
![Page 2: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/2.jpg)
Socket Programming
• Socket is a IPC (Inter Process Communication) facility for network application.
• To make socket communicate with other socket, so it need unique address as a identifier.
• Socket Address contain IP Address and Port Number. Example : 192.168.20.12 : 8080
IP Address Port Number
![Page 3: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/3.jpg)
What is IP ?
![Page 4: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/4.jpg)
W2-1-2, Kuates Staff Politeknik Muadzam Shah, 26700, Pahang D.M
W2-1-2, Kuates Staff Politeknik Muadzam Shah, 26700, Pahang D.M
PC A (Source)
PC B (Destination)
172.168.2.3 10.10.10.34
An Analogy
![Page 5: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/5.jpg)
HERE WE KNOW THE IMPORTANT IS…
![Page 6: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/6.jpg)
Internet Addressing
• IP is stand for Internet Protocol.
• IP is an unique ID.
• It use for communicate between 1 point to another point in network.
• Public & Private
• IPv4 has 32 bits , example : 192.168.32.12
but IP Address is running out….
![Page 7: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/7.jpg)
Quiz :
What is the solution for ipv4 issues?
![Page 8: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/8.jpg)
Quiz :
What is the solution for ipv4 issues?
Answer : ipv6
![Page 9: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/9.jpg)
![Page 10: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/10.jpg)
What is this??
![Page 11: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/11.jpg)
This is IPV4
![Page 12: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/12.jpg)
4,294,672,96
![Page 13: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/13.jpg)
![Page 14: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/14.jpg)
340,282,366,920,938,463,463,374,607,431,768,211,456
![Page 15: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/15.jpg)
340 Undecillion!!!
![Page 16: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/16.jpg)
![Page 17: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/17.jpg)
![Page 18: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/18.jpg)
![Page 19: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/19.jpg)
![Page 20: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/20.jpg)
![Page 21: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/21.jpg)
![Page 22: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/22.jpg)
Internet Addressing in JAVA
• Java is a capable programming language that is capable to support networked environment which support most popular protocol available
• Java API that support internet addressing is :- – InetAddress
• There are two subclasses under it – Inet4Address
– Inet6Address
– An InetAddress object is capable to store IP address or Domain name which later used for communication address or translation between the form available.
![Page 23: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/23.jpg)
IP Addresses & Hostname
• Java.net.InetAddress class
– Represents a single IP Address
– Performs transparent DNS lookups
• Java.net.UnknownHostException class
– Thrown if DNS system can`t find IP address for specific host
![Page 24: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/24.jpg)
InetAddress class • Creating an InetAddress object is as follow:-
• Some of the useful methods within InetAddress class – getHostName()
• It return the host domain name in String format
– getHostAddress() • It return the IP address in String format
– getLocalHost() • It return InetAddress object with local computer address information
with its host name
– getByName() • It return InetAddress object of a destination computer containing its
address and host name
![Page 25: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/25.jpg)
getByName example
![Page 26: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/26.jpg)
getHostName example
![Page 27: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/27.jpg)
getHostAddress example
![Page 28: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/28.jpg)
getLocalHost example
![Page 29: Chapter 2 : Inet Address & Data Stream](https://reader030.vdocuments.us/reader030/viewer/2022032613/586fa2881a28abcc238b6f6f/html5/thumbnails/29.jpg)
Socket & Protocol