¡@

Home 

2014/10/15 ¤U¤È 10:14:16

iphone Programming Glossary: sockaddr

gethostbyname( ) failed in iOS6

http://stackoverflow.com/questions/14082992/gethostbyname-failed-in-ios6

for interface allInterfaces interface NULL interface interface ifa_next unsigned int flags interface ifa_flags struct sockaddr addr interface ifa_addr Check for running IPv4 IPv6 interfaces. Skip the loopback interface. if flags IFF_UP IFF_RUNNING..

How to check for local Wi-Fi (not just cellular connection) using iPhone SDK?

http://stackoverflow.com/questions/1448411/how-to-check-for-local-wi-fi-not-just-cellular-connection-using-iphone-sdk

for my application #import SystemConfiguration SystemConfiguration.h static inline BOOL addressReachable const struct sockaddr_in hostAddress BOOL localWiFiAvailable struct sockaddr_in localWifiAddress bzero localWifiAddress sizeof localWifiAddress.. static inline BOOL addressReachable const struct sockaddr_in hostAddress BOOL localWiFiAvailable struct sockaddr_in localWifiAddress bzero localWifiAddress sizeof localWifiAddress localWifiAddress.sin_len sizeof localWifiAddress localWifiAddress.sin_family.. htonl IN_LINKLOCALNETNUM return addressReachable localWifiAddress static inline BOOL addressReachable const struct sockaddr_in hostAddress const SCNetworkReachabilityRef target SCNetworkReachabilityCreateWithAddress kCFAllocatorDefault const..

USB communication between iPad and Mac or PC

http://stackoverflow.com/questions/7278177/usb-communication-between-ipad-and-mac-or-pc

theiphonewiki.com wiki index.php title Usbmux . What I can provide is the sample code for connect to usbmuxd. struct sockaddr_un endpoint size_t size _usbMuxSocket socket PF_LOCAL SOCK_STREAM 0 endpoint.sun_family AF_LOCAL strncpy endpoint.sun_path.. PF_LOCAL SOCK_STREAM 0 endpoint.sun_family AF_LOCAL strncpy endpoint.sun_path var run usbmuxd 17 size offsetof struct sockaddr_un sun_path strlen endpoint.sun_path 1 connect _usbMuxSocket struct sockaddr endpoint size After that you have to connect.. var run usbmuxd 17 size offsetof struct sockaddr_un sun_path strlen endpoint.sun_path 1 connect _usbMuxSocket struct sockaddr endpoint size After that you have to connect to the port your App listen on iPad. The connect process discussed in the wiki..

iOS - Ping with timeout

http://stackoverflow.com/questions/7437643/ios-ping-with-timeout

question Apple sample code bytesSent sendto CFSocketGetNative self _socket sock packet bytes packet length 0 struct sockaddr self.hostAddress bytes socklen_t self.hostAddress length to change the timeout CFSocketNativeHandle sock CFSocketGetNative.. sec setsockopt sock SOL_SOCKET SO_SNDTIMEO void tv sizeof tv bytesSent sendto sock packet bytes packet length 0 struct sockaddr self.hostAddress bytes socklen_t self.hostAddress length See Apple's docs setsockopt From the above referenced doc SO_SNDTIMEO..

iPhone: Bonjour NSNetService IP address and port

http://stackoverflow.com/questions/938521/iphone-bonjour-nsnetservice-ip-address-and-port

delegate method NSNetService server serverBrowser.servers objectAtIndex 0 NSString name nil NSData address nil struct sockaddr_in socketAddress nil NSString ipString nil int port uint i for i 0 i server addresses count i name server name address.. i for i 0 i server addresses count i name server name address server addresses objectAtIndex i socketAddress struct sockaddr_in address bytes ipString NSString stringWithFormat @ s inet_ntoa socketAddress sin_addr port socketAddress sin_port NSLog.. INET6_ADDRSTRLEN for NSData data in self.addresses memset addressBuffer 0 INET6_ADDRSTRLEN typedef union struct sockaddr sa struct sockaddr_in ipv4 struct sockaddr_in6 ipv6 ip_socket_address ip_socket_address socketAddress ip_socket_address..