1. CHAPTER 2 :
Internet Addressing & Data Stream
By :
Mr. Asyran Zarizi Bin Abdullah
2. 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
6. 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….
22. 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.
23. 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
24. 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