AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Java 8 mac address9/19/2023 ![]() ![]() #: Gets the IPV4 address of the active network adapter. ![]() getsockname() function returns the locally-bound name of the specified socket i.e.In python we specify that using SOCK_DGRAM constant. To connect to a DNS server using a socket you need to use datagram protocol. datagram protocol (WHY? please refer to this post). Similarly for IPv6 addresses AF_INET6 can be used. AF_INET is an address family which is used to specify IPv4 i.e.In this case it will be either your system’s IPv4 or IPv6 address depending on what you have used during the socket creation.Īlso please note the following facts before we see the code which gets us the IP address of the machine. Once we connect, then we can retrieve the local address that our socket used to communicate with the DNS server.Why Google’s DNS server? Well… it’s always UP or rather we expect it to be always up.We will create a socket and instruct it to make use of either IPv4 or IPv6 address and datagram protocol to connect to Google’s DNS server i.e.Here is the brief idea behind my implementation. We will make use of Python’s socket module. ![]()
0 Comments
Read More
Leave a Reply. |