Question about socket calls

Ashish C. Nagre ashishcn@cisco.com
Wed May 26 15:20:00 GMT 1999


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


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /