{"action":"created","issue":{"url":"https://api.github.com/repos/robbiehanson/CocoaAsyncSocket/issues/429","repository_url":"https://api.github.com/repos/robbiehanson/CocoaAsyncSocket","labels_url":"https://api.github.com/repos/robbiehanson/CocoaAsyncSocket/issues/429/labels{/name}","comments_url":"https://api.github.com/repos/robbiehanson/CocoaAsyncSocket/issues/429/comments","events_url":"https://api.github.com/repos/robbiehanson/CocoaAsyncSocket/issues/429/events","html_url":"https://github.com/robbiehanson/CocoaAsyncSocket/issues/429","id":154629621,"number":429,"title":"IPv6 Can't assign requested address","user":{"login":"Smeegol","id":1212201,"avatar_url":"https://avatars.githubusercontent.com/u/1212201?v=3","gravatar_id":"","url":"https://api.github.com/users/Smeegol","html_url":"https://github.com/Smeegol","followers_url":"https://api.github.com/users/Smeegol/followers","following_url":"https://api.github.com/users/Smeegol/following{/other_user}","gists_url":"https://api.github.com/users/Smeegol/gists{/gist_id}","starred_url":"https://api.github.com/users/Smeegol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Smeegol/subscriptions","organizations_url":"https://api.github.com/users/Smeegol/orgs","repos_url":"https://api.github.com/users/Smeegol/repos","events_url":"https://api.github.com/users/Smeegol/events{/privacy}","received_events_url":"https://api.github.com/users/Smeegol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2016-05-13T04:01:43Z","updated_at":"2016-05-30T11:58:24Z","closed_at":null,"body":"As Apple [says](https://developer.apple.com/news/?id=05042016a), tried to connect to IPv4 address in IPv6-only network, here are codes:\r\n\r\nGCDAsyncSocket *socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];\r\nsocket.IPv4PreferredOverIPv6 = NO;\r\n[socket connectToHost:@\"xxx.xxx.xxx.xxx\" onPort:xxx withTimeout:10 error:nil];\r\n\r\nAlways failed with error:\r\nError Domain=NSPOSIXErrorDomain Code=49 \"Can't assign requested address\" UserInfo={NSLocalizedDescription=Can't assign requested address, NSLocalizedFailureReason=Error in connect() function}\r\n\r\nI thought CocoaAsyncSocket will Synthesize IPv6 address from IPv4 address automatically, but I was wrong. Can somebody help me?"},"comment":{"url":"https://api.github.com/repos/robbiehanson/CocoaAsyncSocket/issues/comments/222477158","html_url":"https://github.com/robbiehanson/CocoaAsyncSocket/issues/429#issuecomment-222477158","issue_url":"https://api.github.com/repos/robbiehanson/CocoaAsyncSocket/issues/429","id":222477158,"user":{"login":"Smeegol","id":1212201,"avatar_url":"https://avatars.githubusercontent.com/u/1212201?v=3","gravatar_id":"","url":"https://api.github.com/users/Smeegol","html_url":"https://github.com/Smeegol","followers_url":"https://api.github.com/users/Smeegol/followers","following_url":"https://api.github.com/users/Smeegol/following{/other_user}","gists_url":"https://api.github.com/users/Smeegol/gists{/gist_id}","starred_url":"https://api.github.com/users/Smeegol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Smeegol/subscriptions","organizations_url":"https://api.github.com/users/Smeegol/orgs","repos_url":"https://api.github.com/users/Smeegol/repos","events_url":"https://api.github.com/users/Smeegol/events{/privacy}","received_events_url":"https://api.github.com/users/Smeegol/received_events","type":"User","site_admin":false},"created_at":"2016-05-30T11:58:24Z","updated_at":"2016-05-30T11:58:24Z","body":"Well, thanks @chenzhuolin1002, @newacct and other guys, I finally solve my question by code below:\r\n```\r\n// Found IPv6 address.\r\n// Wrap the native address structure, and add to results.\r\n\r\nstruct sockaddr_in6 *sockaddr = (struct sockaddr_in6 *)res->ai_addr;\r\nin_port_t *portPtr = &sockaddr->sin6_port;\r\nif ((portPtr != NULL) && (*portPtr == 0)) {\r\n        *portPtr = htons(port);\r\n}\r\n\r\nNSData *address6 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen];\r\n[addresses addObject:address6];\r\n```"}}
{"actor":{"display_login":"Smeegol"}}