This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Question about socket calls


Hello,
I am a new user of cygnus and am trying to port a UNIX application to NT
4.0
My problem is as follows:
	
	One of the functions tries to get all the IP addresses associated with
a network interface. For this it creates a DGRAM socket and does a few
other things, but when it makes the following call:

  THIS ONE RIGHT HERE 
	 if (ioctl(fd, SIOCGIFADDR, (char *)&ifr) < 0) {
 *********************************************************
            (void)fprintf(stderr, "Error returned %d",err
            (void)sprintf(errbuf, "SIOCGIFADDR: %s: %s",
               device,strerror(errno));

            (void)close(fd);
            return (-1);
        }

It returns errno = 22 which means Invalid argument.
SIOCGIFADDR has been defined by me as follows:

#define IOC_INOUT       (IOC_IN) /* |IOC_OUT) */
#define _IOWR(x, y, t) \
        (IOC_INOUT|((((int)sizeof (t))&IOCPARM_MASK)<<16)|(x<<8)|y)
#define SIOCGIFADDR     _IOWR('i', 13, struct ifreq)    /* get ifnet
address */

Since there was no _IOWR defined in the include/asm/socket.h

Can someone please tell me how I could get all the IP addresses
associated with an interface or why the above call does not work.
Your help is greatly appreciated.


Regards,
Ashish

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]