https://github.com/davenchy/domain_to_ipv4_c
A simple command-line tool written in C to convert domain names to their corresponding IPv4 addresses
https://github.com/davenchy/domain_to_ipv4_c
c clang dns dns-resolution domain-to-ip domain-to-ip-convert freeaddrinfo getaddrinfo inet ip ipaddress ipv4 linux networking
Last synced: 8 months ago
JSON representation
A simple command-line tool written in C to convert domain names to their corresponding IPv4 addresses
- Host: GitHub
- URL: https://github.com/davenchy/domain_to_ipv4_c
- Owner: Davenchy
- Archived: true
- Created: 2024-04-16T12:49:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-16T12:54:10.000Z (over 1 year ago)
- Last Synced: 2024-10-25T12:35:26.121Z (12 months ago)
- Topics: c, clang, dns, dns-resolution, domain-to-ip, domain-to-ip-convert, freeaddrinfo, getaddrinfo, inet, ip, ipaddress, ipv4, linux, networking
- Language: C
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Domain to IPv4 Converter in C
This project provides a simple command-line tool written in C to convert domain names to their corresponding IPv4 addresses. It uses the getaddrinfo function from the netdb.h library to perform DNS resolution and retrieve IP addresses associated with a given domain name.
## Usage
Simply compile the provided source code and run the executable with the domain name as an argument.
```bash
$ gcc domain_to_ipv4.c -o domain_to_ipv4
``````bash
$ ./domain_to_ipv4
Usage: ./domain_to_ipv4
``````bash
$ ./domain_to_ipv4 example.com
93.184.216.34
```## Resources
- [getaddrinfo(3), freeaddrinfo(3)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html)
- [gai_strerror(3)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/gai_strerror.html)
- [inet_ntop(3)](https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html)