|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| Thanks Jens I'm using BSD sockets so couldn't use CFSocketCopyPeerAddress. Here's the solution (with error checking removed) socklen_t addrLen; struct sockaddr addr; char addrstr[INET6_ADDRSTRLEN]; requestFD = accept(listenFD, &addr, &addrLen); if (addr.sa_family == AF_INET) { struct sockaddr_in temp = *(struct sockaddr_in *)addr.sa_data; inet_ntop(AF_INET, &temp, addrstr, sizeof(addrstr)); } else if (addr.sa_family == AF_INET6) { struct sockaddr_in6 temp = *(struct sockaddr_in6 *)addr.sa_data; inet_ntop(AF_INET6, &temp, addrstr, sizeof(addrstr)); } callerAddress = [[NSString alloc] initWithBytes: addrstr length: addrLen encoding: NSUTF8StringEncoding]; - Ken On May 29, 2011, at 4:43 PM, Jens Alfke wrote:
|
_______________________________________________ Do not post admin requests to the list. They will be ignored. Web-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
| References: | |
| >Getting sender's IP address from CFHTTPMessageRef (From: Ken Tozier <email@hidden>) | |
| >Re: Getting sender's IP address from CFHTTPMessageRef (From: Jens Alfke <email@hidden>) |
| Home | Archives | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2011 Apple Inc. All rights reserved.