SlideShare a Scribd company logo
1 of 17
Java API: java.net.InetAddress
    {   Ankit Gadgil: 11030142027
        Sayak Sarkar: 11030142046
The InetAddress class is the abstraction representing an IP
(Internet Protocol) address, which is either a 32-bit or 128-bit
unsigned number used by IP, a lower-level protocol on which
protocols like UDP and TCP are built.

It has two subclasses:
Inet4Address for IPv4 addresses.

Inet6Address for IPv6 addresses.



In most cases, there is no need to deal directly with the
subclasses, as the InetAddress abstraction covers most of the
needed functionality.




The InetAddress Class
   An instance of an InetAddress consists of an IP address and
    possibly its corresponding host name (depending on whether it is
    constructed with a host name or whether it has already done
    reverse host name resolution).

   The IP address architecture is defined by RFC 790: Assigned
    Numbers, RFC 1918: Address Allocation for Internets, RFC 2365:
    Administratively Scoped IP Multicast, and RFC 2373: IP Version
    6 Addressing Architecture.


   Class Declaration:
    public class InetAddress extends Object implements Serializable




The InetAddress Class
   This class represents an Internet Protocol version 4 (IPv4)
    address.
   It has been defined by RFC790:Assigned Numbers,
    RFC1918: Address Allocation for Private Internets, and
    RFC 2365: Administratively Scoped IP Multicast

   Class Declaration:
    public final class Inet4Address extends InetAddress




The Inet4Address Class
   This class represents an Internet Protocol version 6 (IPv6)
    address.
   It has been defined by RFC 2373: IP Version 6 Addressing
    Architecture.

   Class Declaration:
    public final class Inet6Address extends InetAddress




The Inet6Address Class
unicast: An identifier for a single interface.
A packet sent to a unicast address is delivered to the interface identified
by that address.

The Unspecified Address -- Also called wildcard address, must never be
assigned to any node. It indicates the absence of an address. The
unspecified address must not be used as the destination address of an IP
packet.

The Loopback Addresses -- This is the address assigned to the loopback
interface. Anything sent to this IP address loops around and becomes IP
input on the local host. This address is often used when testing a client.




InetAddress: Address Types
multicast:

An identifier for a set of interfaces (typically belonging to
different nodes). A packet sent to a multicast address is delivered
to all interfaces identified by that address.




    InetAddress: Address Types
   Link-local addresses are designed to be used for addressing
    on a single link for purposes such as auto-address
    configuration, neighbor discovery, or when no routers are
    present.

   Site-local addresses are designed to be used for addressing
    inside of a site without the need for a global prefix.

   Global addresses are unique across the internet.




InetAddress: IP address scope
   Host name-to-IP address resolution is accomplished through the
     use of a combination of local machine configuration information
     and network naming services such as the Domain Name System
     (DNS) and Network Information Service(NIS).

    The particular naming services(s) being used is by default the
     local machine configured one.

    For any host name, its corresponding IP address is returned.
     Reverse name resolution means that for any IP address, the host
     associated with the IP address is returned.

    The InetAddress class provides methods to resolve host names to
     their IP addresses and vice versa.



InetAddress: Host Name Resolution
   The InetAddress class has a cache to store successful as well as
    unsuccessful host name resolutions.

   By default, when a security manager is installed, in order to protect
    against DNS spoofing attacks, the result of positive host name
    resolutions are cached forever.

   When a security manager is not installed, the default behavior is to
    cache entries for a finite (implementation dependent) period of time.

   The result of unsuccessful host name resolution is cached for a very
    short period of time (10 seconds) to improve performance.

   If the default behavior is not desired, then a Java security property
    can be set to a different Time-to-live (TTL) value for positive caching.



InetAddress: Caching
Two Java security properties control the TTL values used for
positive and negative host name resolution caching:

networkaddress.cache.ttl Indicates the caching policy for
successful name lookups from the name service. The value is
specified as integer to indicate the number of seconds to cache the
successful lookup. The default setting is to cache for an
implementation specific period of time. A value of -1 indicates
"cache forever".

networkaddress.cache.negative.ttl (default: 10) Indicates the
caching policy for un-successful name lookups from the name
service. The value is specified as integer to indicate the number of
seconds to cache the failure for un-successful lookups. A value of 0
indicates "never cache". A value of -1 indicates "cache forever".


InetAddress: Caching
Two Java security properties control the TTL values used for
positive and negative host name resolution caching:

networkaddress.cache.ttl Indicates the caching policy for
successful name lookups from the name service. The value is
specified as as integer to indicate the number of seconds to cache
the successful lookup. The default setting is to cache for an
implementation specific period of time. A value of -1 indicates
"cache forever".

networkaddress.cache.negative.ttl (default: 10) Indicates the
caching policy for un-successful name lookups from the name
service. The value is specified as integer to indicate the number of
seconds to cache the failure for un-successful lookups. A value of 0
indicates "never cache". A value of -1 indicates "cache forever".



InetAddress: Caching
 boolean              equals(Object obj)
                                Compares this object against the specified object.

 byte[]               getAddress()
                                Returns the raw IP address of this InetAddress object.

static InetAddress[] getAllByName(String host)
                               Given the name of a host, returns an array of its IP addresses, based
                     on the configured name service on the system.

static InetAddress    getByAddress(byte[] addr)
                                Returns an InetAddress object given the raw IP address .

static InsetAddress getByAddress(String host, byte[] addr)
                              Create an InetAddress based on the provided host name and IP
                    address No name service is checked for the validity of the address.

static InetAddress    getByName(String host)
                                Determines the IP address of a host, given the host's name.



  InetAddress: Methods
 String              getCanonicalHostName()
                               Gets the fully qualified domain name for this IP address.

 String              getHostAddress()
                               Returns the IP address string in textual presentation.

 String              getHostName()
                               Gets the host name for this IP address.

static InetAddress   getLocalHost()
                               Returns the local host.

 int                 hashCode()
                               Returns a hashcode for this IP address.

 boolean             isAnyLocalAddress()
                               Utility routine to check if the InetAddress in a wildcard address.




  InetAddress: Methods
 boolean   isLinkLocalAddress()
                     Utility routine to check if the InetAddress is an link local address.

 boolean   isLoopbackAddress()
                     Utility routine to check if the InetAddress is a loopback address.

 boolean   isMCGlobal()
                     Utility routine to check if the multicast address has global scope.

 boolean   isMCLinkLocal()
                     Utility routine to check if the multicast address has link scope.

 boolean   isMCNodeLocal()
                     Utility routine to check if the multicast address has node scope.

 boolean   isMCOrgLocal()
                     Utility routine to check if the multicast address has organization
           scope.




 InetAddress: Methods
 boolean   isMCSiteLocal()
                     Utility routine to check if the multicast address has site scope.

 boolean   isMulticastAddress()
                     Utility routine to check if the InetAddress is an IP multicast
           address.

 boolean   isReachable(int timeout)
                     Test whether that address is reachable.

 boolean   isReachable(NetworkInterface netif, int ttl, int timeout)
                     Test whether that address is reachable.

 boolean   isSiteLocalAddres()
                     Utility routine to check if the InetAddress is a site local address.

 String    toString()
                     Converts this IP address to a String.




  InetAddress: Methods
Thank You…

More Related Content

What's hot

Java exception handling
Java exception handlingJava exception handling
Java exception handlingBHUVIJAYAVELU
 
Java awt (abstract window toolkit)
Java awt (abstract window toolkit)Java awt (abstract window toolkit)
Java awt (abstract window toolkit)Elizabeth alexander
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVAVINOTH R
 
String and string buffer
String and string bufferString and string buffer
String and string bufferkamal kotecha
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVAAbhilash Nair
 
Java And Multithreading
Java And MultithreadingJava And Multithreading
Java And MultithreadingShraddha
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methodsShubham Dwivedi
 
Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Peter R. Egli
 
Event handling
Event handlingEvent handling
Event handlingswapnac12
 
Overloading and overriding in vb.net
Overloading and overriding in vb.netOverloading and overriding in vb.net
Overloading and overriding in vb.netsuraj pandey
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and responseSahil Agarwal
 

What's hot (20)

Packages in java
Packages in javaPackages in java
Packages in java
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
 
Java awt (abstract window toolkit)
Java awt (abstract window toolkit)Java awt (abstract window toolkit)
Java awt (abstract window toolkit)
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
 
MULTI THREADING IN JAVA
MULTI THREADING IN JAVAMULTI THREADING IN JAVA
MULTI THREADING IN JAVA
 
Php array
Php arrayPhp array
Php array
 
String and string buffer
String and string bufferString and string buffer
String and string buffer
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Awt controls ppt
Awt controls pptAwt controls ppt
Awt controls ppt
 
Applets in java
Applets in javaApplets in java
Applets in java
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
 
Java And Multithreading
Java And MultithreadingJava And Multithreading
Java And Multithreading
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
 
Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)
 
Event handling
Event handlingEvent handling
Event handling
 
Java Tokens
Java  TokensJava  Tokens
Java Tokens
 
Active x control
Active x controlActive x control
Active x control
 
Overloading and overriding in vb.net
Overloading and overriding in vb.netOverloading and overriding in vb.net
Overloading and overriding in vb.net
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 

Viewers also liked

Working with color and font
Working with color and fontWorking with color and font
Working with color and fontmyrajendra
 
Client Server models in JAVA
Client Server models in JAVAClient Server models in JAVA
Client Server models in JAVATech_MX
 
Cache Sketches: Using Bloom Filters and Web Caching Against Slow Load Times
Cache Sketches: Using Bloom Filters and Web Caching Against Slow Load TimesCache Sketches: Using Bloom Filters and Web Caching Against Slow Load Times
Cache Sketches: Using Bloom Filters and Web Caching Against Slow Load TimesFelix Gessert
 
Advance Java-Network Programming
Advance Java-Network ProgrammingAdvance Java-Network Programming
Advance Java-Network Programmingashok hirpara
 
Storage Area Network (San)
Storage Area Network (San)Storage Area Network (San)
Storage Area Network (San)sankcomp
 

Viewers also liked (8)

Working with color and font
Working with color and fontWorking with color and font
Working with color and font
 
URL Class in JAVA
URL Class in JAVAURL Class in JAVA
URL Class in JAVA
 
Url Connection
Url ConnectionUrl Connection
Url Connection
 
Inet
InetInet
Inet
 
Client Server models in JAVA
Client Server models in JAVAClient Server models in JAVA
Client Server models in JAVA
 
Cache Sketches: Using Bloom Filters and Web Caching Against Slow Load Times
Cache Sketches: Using Bloom Filters and Web Caching Against Slow Load TimesCache Sketches: Using Bloom Filters and Web Caching Against Slow Load Times
Cache Sketches: Using Bloom Filters and Web Caching Against Slow Load Times
 
Advance Java-Network Programming
Advance Java-Network ProgrammingAdvance Java-Network Programming
Advance Java-Network Programming
 
Storage Area Network (San)
Storage Area Network (San)Storage Area Network (San)
Storage Area Network (San)
 

Similar to Java API: java.net.InetAddress

CHAPTER - 3 - JAVA NETWORKING.pptx
CHAPTER - 3 - JAVA NETWORKING.pptxCHAPTER - 3 - JAVA NETWORKING.pptx
CHAPTER - 3 - JAVA NETWORKING.pptxDhrumilSheth3
 
Javanetworkingbasicssocketsoverview
JavanetworkingbasicssocketsoverviewJavanetworkingbasicssocketsoverview
Javanetworkingbasicssocketsoverviewrajshreemuthiah
 
Java networking basics & sockets overview
Java networking basics & sockets overviewJava networking basics & sockets overview
Java networking basics & sockets overviewrajshreemuthiah
 
Module 1 networking basics-2
Module 1   networking basics-2Module 1   networking basics-2
Module 1 networking basics-2Ankit Dubey
 
File 10 - CSX 334 _VRA NBO.ppsx
File 10 - CSX 334 _VRA NBO.ppsxFile 10 - CSX 334 _VRA NBO.ppsx
File 10 - CSX 334 _VRA NBO.ppsxgaurav201196
 
Lab manual cn-2012-13
Lab manual cn-2012-13Lab manual cn-2012-13
Lab manual cn-2012-13Sasi Kala
 
Network address translation
Network address translationNetwork address translation
Network address translationVarsha Honde
 
networkaddresstranslation-160909142440.pptx
networkaddresstranslation-160909142440.pptxnetworkaddresstranslation-160909142440.pptx
networkaddresstranslation-160909142440.pptxzmulani8
 
Clase 1 Direccionamiento IPv4.pdf
Clase 1 Direccionamiento IPv4.pdfClase 1 Direccionamiento IPv4.pdf
Clase 1 Direccionamiento IPv4.pdfFERNANDOBONILLA43
 
Core2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdfCore2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdfThchTrngGia
 

Similar to Java API: java.net.InetAddress (20)

CHAPTER - 3 - JAVA NETWORKING.pptx
CHAPTER - 3 - JAVA NETWORKING.pptxCHAPTER - 3 - JAVA NETWORKING.pptx
CHAPTER - 3 - JAVA NETWORKING.pptx
 
Javanetworkingbasicssocketsoverview
JavanetworkingbasicssocketsoverviewJavanetworkingbasicssocketsoverview
Javanetworkingbasicssocketsoverview
 
Java networking basics & sockets overview
Java networking basics & sockets overviewJava networking basics & sockets overview
Java networking basics & sockets overview
 
Module 1 networking basics-2
Module 1   networking basics-2Module 1   networking basics-2
Module 1 networking basics-2
 
Networking
NetworkingNetworking
Networking
 
Java networking
Java networkingJava networking
Java networking
 
Unit 2 : Internet Address
Unit 2 : Internet AddressUnit 2 : Internet Address
Unit 2 : Internet Address
 
Md13 networking
Md13 networkingMd13 networking
Md13 networking
 
File 10 - CSX 334 _VRA NBO.ppsx
File 10 - CSX 334 _VRA NBO.ppsxFile 10 - CSX 334 _VRA NBO.ppsx
File 10 - CSX 334 _VRA NBO.ppsx
 
Chapter 2 : Inet Address & Data Stream
Chapter 2 : Inet Address & Data StreamChapter 2 : Inet Address & Data Stream
Chapter 2 : Inet Address & Data Stream
 
Lab manual cn-2012-13
Lab manual cn-2012-13Lab manual cn-2012-13
Lab manual cn-2012-13
 
Java Networking
Java NetworkingJava Networking
Java Networking
 
Basic socket programming
Basic socket programmingBasic socket programming
Basic socket programming
 
Network address translation
Network address translationNetwork address translation
Network address translation
 
Skip to Main content.docx
Skip to Main content.docxSkip to Main content.docx
Skip to Main content.docx
 
networkaddresstranslation-160909142440.pptx
networkaddresstranslation-160909142440.pptxnetworkaddresstranslation-160909142440.pptx
networkaddresstranslation-160909142440.pptx
 
Spring data
Spring dataSpring data
Spring data
 
A.java
A.javaA.java
A.java
 
Clase 1 Direccionamiento IPv4.pdf
Clase 1 Direccionamiento IPv4.pdfClase 1 Direccionamiento IPv4.pdf
Clase 1 Direccionamiento IPv4.pdf
 
Core2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdfCore2 Document - Java SCORE Overview.pptx.pdf
Core2 Document - Java SCORE Overview.pptx.pdf
 

More from Sayak Sarkar

Google summer of code
Google summer of codeGoogle summer of code
Google summer of codeSayak Sarkar
 
Sculpting a Vibrant Community - MozCamp Asia 2012
Sculpting a Vibrant Community - MozCamp Asia 2012Sculpting a Vibrant Community - MozCamp Asia 2012
Sculpting a Vibrant Community - MozCamp Asia 2012Sayak Sarkar
 

More from Sayak Sarkar (7)

Firefox OS
Firefox OSFirefox OS
Firefox OS
 
Google summer of code
Google summer of codeGoogle summer of code
Google summer of code
 
Webmaker
WebmakerWebmaker
Webmaker
 
Sculpting a Vibrant Community - MozCamp Asia 2012
Sculpting a Vibrant Community - MozCamp Asia 2012Sculpting a Vibrant Community - MozCamp Asia 2012
Sculpting a Vibrant Community - MozCamp Asia 2012
 
MozCarnival Pune
MozCarnival PuneMozCarnival Pune
MozCarnival Pune
 
Mozfest Pune
Mozfest PuneMozfest Pune
Mozfest Pune
 
MozParty Pune
MozParty PuneMozParty Pune
MozParty Pune
 

Recently uploaded

costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 

Recently uploaded (20)

costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 

Java API: java.net.InetAddress

  • 1. Java API: java.net.InetAddress { Ankit Gadgil: 11030142027 Sayak Sarkar: 11030142046
  • 2. The InetAddress class is the abstraction representing an IP (Internet Protocol) address, which is either a 32-bit or 128-bit unsigned number used by IP, a lower-level protocol on which protocols like UDP and TCP are built. It has two subclasses: Inet4Address for IPv4 addresses. Inet6Address for IPv6 addresses. In most cases, there is no need to deal directly with the subclasses, as the InetAddress abstraction covers most of the needed functionality. The InetAddress Class
  • 3. An instance of an InetAddress consists of an IP address and possibly its corresponding host name (depending on whether it is constructed with a host name or whether it has already done reverse host name resolution).  The IP address architecture is defined by RFC 790: Assigned Numbers, RFC 1918: Address Allocation for Internets, RFC 2365: Administratively Scoped IP Multicast, and RFC 2373: IP Version 6 Addressing Architecture.  Class Declaration: public class InetAddress extends Object implements Serializable The InetAddress Class
  • 4. This class represents an Internet Protocol version 4 (IPv4) address.  It has been defined by RFC790:Assigned Numbers, RFC1918: Address Allocation for Private Internets, and RFC 2365: Administratively Scoped IP Multicast  Class Declaration: public final class Inet4Address extends InetAddress The Inet4Address Class
  • 5. This class represents an Internet Protocol version 6 (IPv6) address.  It has been defined by RFC 2373: IP Version 6 Addressing Architecture.  Class Declaration: public final class Inet6Address extends InetAddress The Inet6Address Class
  • 6. unicast: An identifier for a single interface. A packet sent to a unicast address is delivered to the interface identified by that address. The Unspecified Address -- Also called wildcard address, must never be assigned to any node. It indicates the absence of an address. The unspecified address must not be used as the destination address of an IP packet. The Loopback Addresses -- This is the address assigned to the loopback interface. Anything sent to this IP address loops around and becomes IP input on the local host. This address is often used when testing a client. InetAddress: Address Types
  • 7. multicast: An identifier for a set of interfaces (typically belonging to different nodes). A packet sent to a multicast address is delivered to all interfaces identified by that address. InetAddress: Address Types
  • 8. Link-local addresses are designed to be used for addressing on a single link for purposes such as auto-address configuration, neighbor discovery, or when no routers are present.  Site-local addresses are designed to be used for addressing inside of a site without the need for a global prefix.  Global addresses are unique across the internet. InetAddress: IP address scope
  • 9. Host name-to-IP address resolution is accomplished through the use of a combination of local machine configuration information and network naming services such as the Domain Name System (DNS) and Network Information Service(NIS).  The particular naming services(s) being used is by default the local machine configured one.  For any host name, its corresponding IP address is returned. Reverse name resolution means that for any IP address, the host associated with the IP address is returned.  The InetAddress class provides methods to resolve host names to their IP addresses and vice versa. InetAddress: Host Name Resolution
  • 10. The InetAddress class has a cache to store successful as well as unsuccessful host name resolutions.  By default, when a security manager is installed, in order to protect against DNS spoofing attacks, the result of positive host name resolutions are cached forever.  When a security manager is not installed, the default behavior is to cache entries for a finite (implementation dependent) period of time.  The result of unsuccessful host name resolution is cached for a very short period of time (10 seconds) to improve performance.  If the default behavior is not desired, then a Java security property can be set to a different Time-to-live (TTL) value for positive caching. InetAddress: Caching
  • 11. Two Java security properties control the TTL values used for positive and negative host name resolution caching: networkaddress.cache.ttl Indicates the caching policy for successful name lookups from the name service. The value is specified as integer to indicate the number of seconds to cache the successful lookup. The default setting is to cache for an implementation specific period of time. A value of -1 indicates "cache forever". networkaddress.cache.negative.ttl (default: 10) Indicates the caching policy for un-successful name lookups from the name service. The value is specified as integer to indicate the number of seconds to cache the failure for un-successful lookups. A value of 0 indicates "never cache". A value of -1 indicates "cache forever". InetAddress: Caching
  • 12. Two Java security properties control the TTL values used for positive and negative host name resolution caching: networkaddress.cache.ttl Indicates the caching policy for successful name lookups from the name service. The value is specified as as integer to indicate the number of seconds to cache the successful lookup. The default setting is to cache for an implementation specific period of time. A value of -1 indicates "cache forever". networkaddress.cache.negative.ttl (default: 10) Indicates the caching policy for un-successful name lookups from the name service. The value is specified as integer to indicate the number of seconds to cache the failure for un-successful lookups. A value of 0 indicates "never cache". A value of -1 indicates "cache forever". InetAddress: Caching
  • 13.  boolean equals(Object obj)           Compares this object against the specified object.  byte[] getAddress()           Returns the raw IP address of this InetAddress object. static InetAddress[] getAllByName(String host)           Given the name of a host, returns an array of its IP addresses, based on the configured name service on the system. static InetAddress getByAddress(byte[] addr)           Returns an InetAddress object given the raw IP address . static InsetAddress getByAddress(String host, byte[] addr)           Create an InetAddress based on the provided host name and IP address No name service is checked for the validity of the address. static InetAddress getByName(String host)           Determines the IP address of a host, given the host's name. InetAddress: Methods
  • 14.  String getCanonicalHostName()           Gets the fully qualified domain name for this IP address.  String getHostAddress()           Returns the IP address string in textual presentation.  String getHostName()           Gets the host name for this IP address. static InetAddress getLocalHost()           Returns the local host.  int hashCode()           Returns a hashcode for this IP address.  boolean isAnyLocalAddress()           Utility routine to check if the InetAddress in a wildcard address. InetAddress: Methods
  • 15.  boolean isLinkLocalAddress()           Utility routine to check if the InetAddress is an link local address.  boolean isLoopbackAddress()           Utility routine to check if the InetAddress is a loopback address.  boolean isMCGlobal()           Utility routine to check if the multicast address has global scope.  boolean isMCLinkLocal()           Utility routine to check if the multicast address has link scope.  boolean isMCNodeLocal()           Utility routine to check if the multicast address has node scope.  boolean isMCOrgLocal()           Utility routine to check if the multicast address has organization scope. InetAddress: Methods
  • 16.  boolean isMCSiteLocal()           Utility routine to check if the multicast address has site scope.  boolean isMulticastAddress()           Utility routine to check if the InetAddress is an IP multicast address.  boolean isReachable(int timeout)           Test whether that address is reachable.  boolean isReachable(NetworkInterface netif, int ttl, int timeout)           Test whether that address is reachable.  boolean isSiteLocalAddres()           Utility routine to check if the InetAddress is a site local address.  String toString()           Converts this IP address to a String. InetAddress: Methods