{"id":565,"date":"2008-05-13T19:10:03","date_gmt":"2008-05-13T19:10:03","guid":{"rendered":"http:\/\/6teen.ru\/?p=400"},"modified":"2008-05-13T19:10:03","modified_gmt":"2008-05-13T19:10:03","slug":"4718","status":"publish","type":"post","link":"http:\/\/pblog.ru\/lab\/?p=565","title":{"rendered":"\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 IP \u0430\u0434\u0440\u0435\u0441"},"content":{"rendered":"<p>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 IP \u0430\u0434\u0440\u0435\u0441<br \/>\n<!--more--><\/p>\n<pre class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; width:580px; height:320px; overflow:auto\"><div>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 IP \u0430\u0434\u0440\u0435\u0441\n\nfunction LocalIP : string;\ntype\n    TaPInAddr = array [0..10] of PInAddr;\n    PaPInAddr = ^TaPInAddr;\nvar phe  : PHostEnt;\n    pptr : PaPInAddr;\n    Buffer : array [0..63] of char;\n    I    : Integer;\n    GInitData      : TWSADATA;\nbegin\n    WSAStartup($101, GInitData);\n    Result := '';\n    GetHostName(Buffer, SizeOf(Buffer));\n    phe :=GetHostByName(buffer);\n    if phe = nil then Exit;\n    pptr := PaPInAddr(Phe^.h_addr_list);\n    I := 0;\n    while pptr^[I] <> nil do begin\n      result:=StrPas(inet_ntoa(pptr^[I]^));\n      Inc(I);\n    end;\n    WSACleanup;\nend;\n\n\u0438\u043b\u0438\n\nuses\nWinSock;\n\nfunction GetLocalIP: String;\nconst WSVer = $101;\nvar\nwsaData: TWSAData;\nP: PHostEnt;\nBuf: array [0..127] of Char;\nbegin\nResult := '';\nif WSAStartup(WSVer, wsaData) = 0 then\nbegin\nif GetHostName(@Buf, 128) = 0 then\nbegin\nP := GetHostByName(@Buf);\nif P <> nil then\nResult := iNet_ntoa(PInAddr(p^.h_addr_list^)^);\nend;\nWSACleanup;\nend;\nend;\n<\/div><\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 IP \u0430\u0434\u0440\u0435\u0441<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[448,457],"tags":[611,1413,913],"_links":{"self":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/565"}],"collection":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=565"}],"version-history":[{"count":0,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/565\/revisions"}],"wp:attachment":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=565"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}