{"id":168,"date":"2019-04-21T22:27:53","date_gmt":"2019-04-21T13:27:53","guid":{"rendered":"https:\/\/www.oji-koji.com\/?p=168"},"modified":"2019-04-21T22:38:03","modified_gmt":"2019-04-21T13:38:03","slug":"%e5%88%9d%e3%82%81%e3%81%a6%e3%81%ae%e3%82%bd%e3%82%b1%e3%83%83%e3%83%88api%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%9f%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0","status":"publish","type":"post","link":"https:\/\/www.oji-koji.com\/?p=168","title":{"rendered":"\u521d\u3081\u3066\u306e\u30bd\u30b1\u30c3\u30c8API\u3092\u4f7f\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0(\u4f7f\u7528\u3059\u308bAPI)"},"content":{"rendered":"\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9API\u3092\u4f7f\u3063\u3066\u521d\u3081\u3066\u306e\u30bd\u30b1\u30c3\u30c8API\u3092\u3064\u304b\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"program_discription\">\u3053\u3053\u3067\u306f\u3001IPv4\/IPv6\u4e21\u65b9\u3067\u4f7f\u3048\u308bAPI\u3092\u4f7f\u7528\u3057\u307e\u3059\n  \u53c2\u8003\u6587\u66f8\uff1aRFC3493\n    Basic Socket Interface Extensions for IPv6<\/p>\n\n\n\n<p class=\"program_discription\">(*)\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u95a2\u3059\u308b\u60c5\u5831\u306fRFC(Request For Comments )\u3067\n   \u4e16\u754c\u4e2d\u3067\u5171\u6709\u3055\u308c\u3066\u3044\u307e\u3059\u3002\n     <a href=\"https:\/\/datatracker.ietf.org\/\">https:\/\/datatracker.ietf.org\/<\/a>\n     \u3067\u8abf\u3079\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\n     RFC3493\u3092\u5165\u529b\u3057\u3066\u3001\u691c\u7d22\u3059\u308b\u3068\u3053\u3053\u3067\u4f7f\u7528\u3059\u308bAPI\u3092\u306f\u3058\u3081\u3068\u3059\u308b\n     \u60c5\u5831\u304c\u8a18\u8ff0\u3055\u308c\u3066\u3044\u308b\u6587\u66f8\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u4f7f\u7528\u3059\u308bAPI\u306f\u6b21\u306e\u3082\u306e\u3067\u3059<br><\/p>\n\n\n\n<p class=\"has-text-color has-vivid-red-color\">\n(*)gethostbyname\u306a\u3069\u306eIPv4\u3067\u3057\u304b\u4f7f\u3048\u306a\u3044API\u306f\u4f7f\u7528\u3057\u307e\u305b\u3093\u3002\n<\/p>\n\n\n\n<p class=\"program_discription\">int gethostname(char *name, size_t len);\n    \u73fe\u5728\u306e\u30d7\u30ed\u30bb\u30c3\u30b5\u306e\u30db\u30b9\u30c8\u540d\u306e\u53d6\u5f97<\/p>\n\n\n\n<p class=\"program_discription\">int getaddrinfo(const char *node, const char *service,\n    const struct addrinfo *hints,\n    struct addrinfo **res);\n    \u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306e\u30db\u30b9\u30c8(node)\u3068\u30b5\u30fc\u30d3\u30b9(service)\u3092\u6e21\u3059\u3068\u3001\u4e00\u3064\u4ee5\u4e0a\u306e \n    addrinfo \u69cb\u9020\u4f53\uff08\u30ea\u30b9\u30c8\u306b\u306a\u3063\u3066\u3044\u307e\u3059\uff09\u3092\u8fd4\u3057\u307e\u3059\u3002\n    \u305d\u308c\u305e\u308c\u306e addrinfo \u69cb\u9020\u4f53\u306b\u306f\u3001 bind \u3084 connect \u3092\u547c\u3073\u51fa\u3059\u969b\u306b\n    \u6307\u5b9a\u3067\u304d\u308b\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30a2\u30c9\u30ec\u30b9\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u307e\u3059<\/p>\n\n\n\n<p class=\"source_code\">\u3010addrinfo \u69cb\u9020\u4f53\u3011\nstruct addrinfo {\nint             ai_flags;      \/\/ AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST,\u2026\nint             ai_family;     \/\/ AF_INET, AF_INET6, AF_UNSPEC\nint             ai_socktype;   \/\/ SOCK_STREAM, SOCK_DGRAM,\u2026\nint             ai_protocol;   \/\/ 0 or IPPROTO_xxx\nsocklen_t       ai_addrlen;    \/\/ ai_addr\u306e\u9577\u3055\nstruct sockaddr *ai_addr;      \/\/ \u30a2\u30c9\u30ec\u30b9(\u30d0\u30a4\u30ca\u30ea)\u3078\u306e\u30dd\u30a4\u30f3\u30bf\u30fc\nchar            *ai_canonname; \/\/ \u30db\u30b9\u30c8\u306e\u516c\u5f0f\u306a\u540d\u524d\nstruct addrinfo *ai_next;      \/\/ \u6b21\u306e\u60c5\u5831\u3078\u306e\u30dd\u30a4\u30f3\u30bf\n};<\/p>\n\n\n\n<p class=\"program_discription\">void freeaddrinfo(struct addrinfo *res);\n    getaddrinfo\u3067\u52d5\u7684\u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u305f\u30ea\u30b9\u30c8 res \u30e1\u30e2\u30ea\u30fc\u3092\u89e3\u653e\u3057\u307e\u3059\n\nint getnameinfo(const struct sockaddr *sa, socklen_t salen,\n    char *host, socklen_t hostlen,\n    char *serv, socklen_t servlen, int flags);\n    \u30d7\u30ed\u30c8\u30b3\u30eb\u306b\u4f9d\u5b58\u3057\u306a\u3044\u304b\u305f\u3061\u3067 \u30bd\u30b1\u30c3\u30c8\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u5bfe\u5fdc\u3059\u308b\u30db\u30b9\u30c8\u540d\u3068\n    \u30b5\u30fc\u30d3\u30b9\u3092\u53d6\u5f97\u3057\u307e\u3059\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9API\u3092\u4f7f\u3063\u3066\u521d\u3081\u3066\u306e\u30bd\u30b1\u30c3\u30c8API\u3092\u3064\u304b\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u308a\u307e\u3059\u3002 \u3053\u3053\u3067\u306f\u3001IPv4\/IPv6\u4e21\u65b9\u3067\u4f7f\u3048\u308bAPI\u3092\u4f7f\u7528\u3057\u307e\u3059 \u53c2\u8003\u6587\u66f8\uff1aRFC3493 Basic Socket Interface Ext [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":129,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_locale":"","_original_post":"","footnotes":""},"categories":[6],"tags":[],"class_list":["post-168","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-networkprograming","ja"],"_links":{"self":[{"href":"https:\/\/www.oji-koji.com\/index.php?rest_route=\/wp\/v2\/posts\/168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oji-koji.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oji-koji.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oji-koji.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oji-koji.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=168"}],"version-history":[{"count":26,"href":"https:\/\/www.oji-koji.com\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions"}],"predecessor-version":[{"id":202,"href":"https:\/\/www.oji-koji.com\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions\/202"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.oji-koji.com\/index.php?rest_route=\/wp\/v2\/media\/129"}],"wp:attachment":[{"href":"https:\/\/www.oji-koji.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oji-koji.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oji-koji.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}