InetSocketAddress vs InetAddress

Can someone explain to me if there is a difference between classes InetAddressand InetSocketAddressin java, and if there is a difference, please explain the same. I google-ed this, but I could not find anything explanatory.

+5
source share
2 answers

Inetaddress

An InetAddress instance consists of an IP address and possibly the corresponding host name

InetSocketAddress

This class implements an IP-Socket address (IP address + port number). It can also be a pair (hostname + port number), in which case an attempt will be made to resolve the hostname

+10
source

They represent various OSI layers :

0

All Articles