From the course: Network Programming in C: Develop Reliable Client/Server Applications
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Discover local interfaces - C Tutorial
From the course: Network Programming in C: Develop Reliable Client/Server Applications
Discover local interfaces
- [Instructor] Modern computers feature multiple network interfaces. In Linux, the command to output this information is IP address, ADDR, show. This list outputs tons of detail. For Mac OS in the terminal app, use the command IF config to see similar information. Some computers may use IP config, again, to output the same or similar information. You can also glean this information in your C code, thanks to the get IF ADDRS function. This function is defined in the IFADDRS H header file. It requires a single argument, the address of a pointer to an IF ADDRS structure. The function returns zero upon success, negative one, otherwise with an error, no value set, indicating the error. This is the IF ADDRS structure's definition from the man page. It's a length list, as you can see, by the IFA next member. The IFA name member is the interface's name, a string, and the IFA ADDR member is another structure that contains the IP…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
View the big network picture2m 52s
-
(Locked)
Configure the firewall2m 51s
-
(Locked)
Understand the Internet Protocol (IP)3m 30s
-
(Locked)
Explore network addresses and ports3m 26s
-
(Locked)
Access local network details4m 4s
-
(Locked)
Discover local interfaces3m 45s
-
(Locked)
Review the client/server roles2m 48s
-
-
-
-
-
-