Do you have a question? Post it now! No Registration Necessary
Subject
- Posted on

Re: getting IP addresses of network interfaces on Linux box

There are IOCTL's you can call on a socket fd, something like this, from
the top of my head:
int fd;
strict ifreq ifr;
struct sockaddr_sin *sa;
fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
strcpy(ifr.ifr_name, ifname); /* Don't use strcpy */
ioctl(fd, SIOGCIFADDR, &ifr);
sa = (struct sockaddr_in *)(ifr.ifr_addr);
--
:wq
^X^Cy^K^X^C^C^C^C
:wq
^X^Cy^K^X^C^C^C^C
Site Timeline
- » DMA transfer size limited on MPC8272
- — Next thread in » Embedded Linux
-
- » how to select whihc is better embedded Linux OS for MPC82xx processor?
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » GMR-R-Kopf aus Festplatten
- — The site's Newest Thread. Posted in » Electronics (German)
-
- » OT: "We can stay retarded longer than they can stay solvent.?
- — The site's Last Updated Thread. Posted in » Electronics Design
-