chapter 2 : inet address & data stream

29
CHAPTER 2 : Internet Addressing & Data Stream By : Mr. Asyran Zarizi Bin Abdullah

Upload: ministry-of-higher-education

Post on 16-Apr-2017

445 views

Category:

Education


2 download

TRANSCRIPT

Page 1: Chapter 2 : Inet Address & Data Stream

CHAPTER 2 : Internet Addressing & Data Stream

By :

Mr. Asyran Zarizi Bin Abdullah

Page 2: Chapter 2 : Inet Address & Data Stream

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

What is IP ?

Page 4: Chapter 2 : Inet Address & Data Stream

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

HERE WE KNOW THE IMPORTANT IS…

Page 6: Chapter 2 : Inet Address & Data Stream

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

Quiz :

What is the solution for ipv4 issues?

Page 8: Chapter 2 : Inet Address & Data Stream

Quiz :

What is the solution for ipv4 issues?

Answer : ipv6

Page 9: Chapter 2 : Inet Address & Data Stream
Page 10: Chapter 2 : Inet Address & Data Stream

What is this??

Page 11: Chapter 2 : Inet Address & Data Stream

This is IPV4

Page 12: Chapter 2 : Inet Address & Data Stream

4,294,672,96

Page 13: Chapter 2 : Inet Address & Data Stream
Page 14: Chapter 2 : Inet Address & Data Stream

340,282,366,920,938,463,463,374,607,431,768,211,456

Page 15: Chapter 2 : Inet Address & Data Stream

340 Undecillion!!!

Page 16: Chapter 2 : Inet Address & Data Stream
Page 17: Chapter 2 : Inet Address & Data Stream
Page 18: Chapter 2 : Inet Address & Data Stream
Page 19: Chapter 2 : Inet Address & Data Stream
Page 20: Chapter 2 : Inet Address & Data Stream
Page 21: Chapter 2 : Inet Address & Data Stream
Page 22: Chapter 2 : Inet Address & Data Stream

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

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

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

getByName example

Page 26: Chapter 2 : Inet Address & Data Stream

getHostName example

Page 27: Chapter 2 : Inet Address & Data Stream

getHostAddress example

Page 28: Chapter 2 : Inet Address & Data Stream

getLocalHost example

Page 29: Chapter 2 : Inet Address & Data Stream

Socket & Protocol