{"id":40176,"date":"2026-02-25T01:40:58","date_gmt":"2026-02-24T22:40:58","guid":{"rendered":"https:\/\/fatihsoysal.com\/blog\/?p=40176"},"modified":"2026-02-25T01:40:58","modified_gmt":"2026-02-24T22:40:58","slug":"python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber","status":"publish","type":"post","link":"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/","title":{"rendered":"Python ile Hostname&#8217;den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber"},"content":{"rendered":"<h2>Python ile Hostname&#8217;den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber<\/h2>\n<p><body><\/p>\n<h2>Giri\u015f<\/h2>\n<p>\u0130nternet d\u00fcnyas\u0131nda, kaynaklara eri\u015fim genellikle okunmas\u0131 ve ak\u0131lda tutulmas\u0131 kolay alan adlar\u0131 (hostname) \u00fczerinden ger\u00e7ekle\u015fir. \u00d6rne\u011fin, bir web sitesine eri\u015fmek istedi\u011fimizde &#8220;www.example.com&#8221; gibi bir adres yazar\u0131z. Ancak bilgisayarlar ve a\u011f cihazlar\u0131 bu alan adlar\u0131n\u0131 do\u011frudan anlayamaz; onlar i\u00e7in her kayna\u011f\u0131n benzersiz bir say\u0131sal adresi, yani bir IP adresi (Internet Protocol Address) olmal\u0131d\u0131r. Bu d\u00f6n\u00fc\u015f\u00fcm s\u00fcreci, Alan Ad\u0131 Sistemi (DNS &#8211; Domain Name System) taraf\u0131ndan ger\u00e7ekle\u015ftirilir. Bir hostname&#8217;i IP adresine \u00e7evirme i\u015flemi, a\u011f programlaman\u0131n temel ta\u015flar\u0131ndan biridir ve Python, bu i\u015flemi ger\u00e7ekle\u015ftirmek i\u00e7in g\u00fc\u00e7l\u00fc ve esnek ara\u00e7lar sunar.<\/p>\n<p>Bu makalede, Python&#8217;\u0131n <code>socket<\/code> mod\u00fcl\u00fc arac\u0131l\u0131\u011f\u0131yla bir hostname&#8217;den IP adresi \u00e7\u00f6z\u00fcmleme s\u00fcrecini, farkl\u0131 fonksiyonlar\u0131n (\u00f6zellikle <code>gethostbyname<\/code>, <code>gethostbyname_ex<\/code> ve <code>getaddrinfo<\/code>) detayl\u0131 kullan\u0131mlar\u0131n\u0131, IPv4 ve IPv6 deste\u011fini, hata y\u00f6netimini, performans konular\u0131n\u0131 ve \u00e7e\u015fitli pratik uygulama senaryolar\u0131n\u0131 kapsaml\u0131 bir \u015fekilde inceleyece\u011fiz. Amac\u0131m\u0131z, okuyuculara bu konuda derinlemesine bir anlay\u0131\u015f kazand\u0131rmak ve Python uygulamalar\u0131nda hostname \u00e7\u00f6z\u00fcmleme i\u015flemlerini g\u00fcvenli ve verimli bir \u015fekilde nas\u0131l ger\u00e7ekle\u015ftireceklerini g\u00f6stermektir.<\/p>\n<h2>DNS Nedir ve Nas\u0131l \u00c7al\u0131\u015f\u0131r?<\/h2>\n<p>Hostname&#8217;den IP adresi \u00e7\u00f6z\u00fcmleme konusunu anlamak i\u00e7in \u00f6ncelikle DNS&#8217;in temel prensiplerini kavramak \u00f6nemlidir. DNS, internetin telefon rehberi olarak tan\u0131mlanabilir. \u0130nsanlar\u0131n alan adlar\u0131n\u0131 kullanarak web sitelerine veya di\u011fer a\u011f kaynaklar\u0131na eri\u015fmesini sa\u011flarken, arka planda bu alan adlar\u0131n\u0131 bilgisayarlar\u0131n anlayabilece\u011fi IP adreslerine \u00e7evirir.<\/p>\n<h3>DNS&#8217;in Temel Tan\u0131m\u0131 ve Alan Ad\u0131 Hiyerar\u015fisi<\/h3>\n<p>DNS, da\u011f\u0131t\u0131k bir veritaban\u0131 sistemidir. Milyarlarca alan ad\u0131n\u0131 ve bunlara kar\u015f\u0131l\u0131k gelen IP adreslerini d\u00fcnya genelindeki sunucularda saklar. Alan adlar\u0131 hiyerar\u015fik bir yap\u0131ya sahiptir. En \u00fcst seviyede k\u00f6k alan ad\u0131 (root domain) bulunur, ard\u0131ndan \u00fcst d\u00fczey alan adlar\u0131 (TLD &#8211; Top-Level Domain) gelir (.com, .org, .net, .tr vb.). Bu TLD&#8217;lerin alt\u0131nda ise ikinci d\u00fczey alan adlar\u0131 (example.com) ve alt alan adlar\u0131 (www.example.com, mail.example.com) yer al\u0131r. Her seviye, kendi alt\u0131nda yer alan alan adlar\u0131n\u0131n y\u00f6netiminden sorumludur.<\/p>\n<h3>\u00c7\u00f6z\u00fcmleme S\u00fcreci<\/h3>\n<p>Bir kullan\u0131c\u0131 bir alan ad\u0131n\u0131 taray\u0131c\u0131s\u0131na yazd\u0131\u011f\u0131nda veya bir uygulama bir hostname&#8217;i \u00e7\u00f6z\u00fcmlemeye \u00e7al\u0131\u015ft\u0131\u011f\u0131nda, a\u015fa\u011f\u0131daki ad\u0131mlar genel olarak izlenir:<br \/>\n1.  <strong>Yerel DNS \u00c7\u00f6z\u00fcmleyici (Resolver):<\/strong> \u0130lk olarak, kullan\u0131c\u0131n\u0131n bilgisayar\u0131ndaki i\u015fletim sistemi veya a\u011f cihaz\u0131 (\u00f6rne\u011fin modem\/router) kendi DNS \u00f6nbelle\u011fini kontrol eder. E\u011fer istenen alan ad\u0131n\u0131n IP adresi \u00f6nbellekte varsa, do\u011frudan oradan al\u0131n\u0131r ve i\u015flem tamamlan\u0131r.<br \/>\n2.  <strong>\u00d6zyinelemeli Sorgu (Recursive Query):<\/strong> E\u011fer \u00f6nbellekte bulunamazsa, yerel DNS \u00e7\u00f6z\u00fcmleyici, yap\u0131land\u0131r\u0131lm\u0131\u015f oldu\u011fu DNS sunucusuna (genellikle ISS&#8217;nin DNS sunucusu veya Google DNS gibi halka a\u00e7\u0131k bir sunucu) bir \u00f6zyinelemeli sorgu g\u00f6nderir. Bu sunucu, istemci ad\u0131na tam IP adresini bulmaktan sorumludur.<br \/>\n3.  <strong>K\u00f6k DNS Sunucular\u0131 (Root Servers):<\/strong> Yerel DNS sunucusu, iste\u011fi k\u00f6k DNS sunucular\u0131ndan birine iletir. K\u00f6k sunucular, hangi TLD sunucusunun (\u00f6rne\u011fin .com sunucusu) ilgili alan ad\u0131ndan sorumlu oldu\u011funu bilir.<br \/>\n4.  <strong>TLD DNS Sunucular\u0131:<\/strong> K\u00f6k sunucu, TLD sunucusunun adresini yerel DNS sunucusuna d\u00f6nd\u00fcr\u00fcr. Yerel DNS sunucusu daha sonra TLD sunucusuna sorgu g\u00f6nderir. TLD sunucusu, istenen alan ad\u0131n\u0131n yetkili DNS sunucusunun (Authoritative Name Server) adresini bilir.<br \/>\n5.  <strong>Yetkili DNS Sunucular\u0131 (Authoritative Name Servers):<\/strong> TLD sunucusu, yetkili DNS sunucusunun adresini yerel DNS sunucusuna d\u00f6nd\u00fcr\u00fcr. Yetkili sunucu, belirli bir alan ad\u0131 i\u00e7in IP adresinin nihai kayna\u011f\u0131d\u0131r. Yerel DNS sunucusu bu sunucuya sorgu g\u00f6nderir ve yetkili sunucu, istenen hostname&#8217;in IP adresini d\u00f6nd\u00fcr\u00fcr.<br \/>\n6.  <strong>Cevap ve \u00d6nbellekleme:<\/strong> Yerel DNS sunucusu, IP adresini istemciye d\u00f6nd\u00fcr\u00fcr ve bu bilgiyi belirli bir s\u00fcre (TTL &#8211; Time To Live) boyunca kendi \u00f6nbelle\u011finde saklar. Bu, ayn\u0131 alan ad\u0131 i\u00e7in yap\u0131lan sonraki sorgular\u0131n daha h\u0131zl\u0131 yan\u0131tlanmas\u0131n\u0131 sa\u011flar.<\/p>\n<p>Bu karma\u015f\u0131k s\u00fcre\u00e7, Python&#8217;\u0131n <code>socket<\/code> mod\u00fcl\u00fc gibi ara\u00e7lar arac\u0131l\u0131\u011f\u0131yla bizim i\u00e7in soyutlan\u0131r ve tek bir fonksiyon \u00e7a\u011fr\u0131s\u0131yla kolayca ger\u00e7ekle\u015ftirilebilir hale gelir.<\/p>\n<h2>Python&#8217;da <code>socket<\/code> Mod\u00fcl\u00fc<\/h2>\n<p>Python&#8217;\u0131n <code>socket<\/code> mod\u00fcl\u00fc, a\u011f programlaman\u0131n temelini olu\u015fturur. Bu mod\u00fcl, d\u00fc\u015f\u00fck seviyeli a\u011f ileti\u015fimi i\u00e7in gerekli olan soket aray\u00fcz\u00fcn\u00fc sa\u011flar. Soketler, bir program\u0131n a\u011f \u00fczerinden di\u011fer programlarla ileti\u015fim kurmas\u0131n\u0131 sa\u011flayan u\u00e7 noktalard\u0131r. <code>socket<\/code> mod\u00fcl\u00fc, TCP\/IP, UDP ve di\u011fer a\u011f protokolleri \u00fczerinden veri g\u00f6nderip almak i\u00e7in fonksiyonlar ve s\u0131n\u0131flar i\u00e7erir.<\/p>\n<p>Hostname&#8217;den IP adresi \u00e7\u00f6z\u00fcmleme i\u015flemleri de <code>socket<\/code> mod\u00fcl\u00fc i\u00e7inde yer alan \u00f6zel fonksiyonlar arac\u0131l\u0131\u011f\u0131yla ger\u00e7ekle\u015ftirilir. Bu fonksiyonlar, i\u015fletim sisteminin alt\u0131nda yatan DNS \u00e7\u00f6z\u00fcmleme mekanizmalar\u0131n\u0131 kullanarak, verdi\u011fimiz bir hostname&#8217;i ilgili IP adresine veya adreslerine \u00e7evirir.<\/p>\n<h2><code>socket.gethostbyname()<\/code> Kullan\u0131m\u0131<\/h2>\n<p><code>socket.gethostbyname()<\/code> fonksiyonu, Python&#8217;da bir hostname&#8217;i IP adresine \u00e7evirmek i\u00e7in kullan\u0131lan en temel ve en eski y\u00f6ntemlerden biridir.<\/p>\n<h3>Fonksiyonun Tan\u0131m\u0131 ve \u0130mzas\u0131<\/h3>\n<p><code>socket.gethostbyname(hostname)<\/code>: Verilen <code>hostname<\/code> i\u00e7in kar\u015f\u0131l\u0131k gelen IP adresini (IPv4 format\u0131nda) bir string olarak d\u00f6nd\u00fcr\u00fcr.<\/p>\n<h3>Basit Kullan\u0131m \u00d6rnekleri<\/h3>\n<p>A\u015fa\u011f\u0131daki \u00f6rnek, &#8220;google.com&#8221; hostname&#8217;ini kullanarak IP adresini nas\u0131l alaca\u011f\u0131n\u0131z\u0131 g\u00f6sterir:<\/p>\n<pre><code class=\"language-python\">import socket\n\ntry:\n    hostname = \"google.com\"\n    ip_address = socket.gethostbyname(hostname)\n    print(f\"{hostname} adresinin IP'si: {ip_address}\")\n\n    hostname = \"localhost\"\n    ip_address = socket.gethostbyname(hostname)\n    print(f\"{hostname} adresinin IP'si: {ip_address}\")\n\n    hostname = \"127.0.0.1\" # Zaten bir IP adresi oldu\u011fu i\u00e7in do\u011frudan d\u00f6nd\u00fcr\u00fcr\n    ip_address = socket.gethostbyname(hostname)\n    print(f\"{hostname} adresinin IP'si: {ip_address}\")\n\nexcept socket.gaierror as e:\n    print(f\"Hata olu\u015ftu: {e}\")\nexcept Exception as e:\n    print(f\"Beklenmedik bir hata olu\u015ftu: {e}\")<\/code><\/pre>\n<p>Bu kod \u00e7al\u0131\u015ft\u0131r\u0131ld\u0131\u011f\u0131nda, &#8220;google.com&#8221; i\u00e7in bir IP adresi (\u00f6rne\u011fin &#8220;142.250.186.174&#8221; gibi bir IPv4 adresi) ve &#8220;localhost&#8221; i\u00e7in &#8220;127.0.0.1&#8221; \u00e7\u0131kt\u0131s\u0131 verecektir. E\u011fer <code>hostname<\/code> zaten bir IP adresi ise, fonksiyon bu IP adresini do\u011frudan d\u00f6nd\u00fcr\u00fcr.<\/p>\n<h3>S\u0131n\u0131rlamalar\u0131<\/h3>\n<p><code>socket.gethostbyname()<\/code> fonksiyonunun baz\u0131 \u00f6nemli s\u0131n\u0131rlamalar\u0131 vard\u0131r:<br \/>\n*   <strong>Sadece IPv4:<\/strong> Bu fonksiyon sadece IPv4 adreslerini \u00e7\u00f6z\u00fcmleyebilir. IPv6 adreslerini desteklemez.<br \/>\n*   <strong>Tek IP Adresi:<\/strong> Bir hostname&#8217;in birden fazla IP adresi olabilir (\u00f6rne\u011fin, y\u00fck dengeleme amac\u0131yla). Ancak <code>gethostbyname()<\/code> her zaman bu IP adreslerinden yaln\u0131zca birini d\u00f6nd\u00fcr\u00fcr. Hangi IP adresinin d\u00f6nd\u00fcr\u00fclece\u011fi, DNS sunucusunun yap\u0131land\u0131rmas\u0131na ve yan\u0131t s\u0131ras\u0131na ba\u011fl\u0131 olabilir.<br \/>\n*   <strong>Eski Fonksiyon:<\/strong> Daha yeni ve esnek fonksiyonlar (\u00f6zellikle <code>getaddrinfo<\/code>) mevcut oldu\u011fundan, genellikle <code>gethostbyname()<\/code> yerine bu fonksiyonlar\u0131n kullan\u0131lmas\u0131 \u00f6nerilir.<\/p>\n<p>Bu s\u0131n\u0131rlamalar nedeniyle, daha karma\u015f\u0131k veya modern uygulamalar i\u00e7in genellikle <code>gethostbyname_ex()<\/code> veya <code>getaddrinfo()<\/code> fonksiyonlar\u0131 tercih edilir.<\/p>\n<h2><code>socket.gethostbyname_ex()<\/code> ile Detayl\u0131 Bilgi<\/h2>\n<p><code>socket.gethostbyname_ex()<\/code> fonksiyonu, <code>gethostbyname()<\/code>&#8216;in s\u0131n\u0131rlamalar\u0131n\u0131 a\u015fmak ve bir hostname hakk\u0131nda daha detayl\u0131 bilgi edinmek i\u00e7in tasarlanm\u0131\u015ft\u0131r. \u00d6zellikle, bir hostname&#8217;e ait olabilecek t\u00fcm IP adreslerini ve varsa di\u011fer alan adlar\u0131n\u0131 (alias) listeleme yetene\u011fine sahiptir.<\/p>\n<h3>Fonksiyonun Tan\u0131m\u0131 ve \u0130mzas\u0131<\/h3>\n<p><code>socket.gethostbyname_ex(hostname)<\/code>: Verilen <code>hostname<\/code> i\u00e7in bir \u00fc\u00e7 elemanl\u0131 tuple d\u00f6nd\u00fcr\u00fcr: <code>(canonical_hostname, alias_list, ip_address_list)<\/code>.<br \/>\n*   <code>canonical_hostname<\/code>: \u0130stenen hostname&#8217;in resmi (ger\u00e7ek) ad\u0131d\u0131r. E\u011fer sorgulanan hostname bir alias ise, bu de\u011fer as\u0131l hostname&#8217;i g\u00f6sterir.<br \/>\n*   <code>alias_list<\/code>: \u0130stenen hostname i\u00e7in bilinen di\u011fer alan adlar\u0131n\u0131n (alias) bir listesidir. E\u011fer yoksa bo\u015f bir liste d\u00f6ner.<br \/>\n*   <code>ip_address_list<\/code>: Hostname&#8217;e ait t\u00fcm IPv4 adreslerinin bir listesidir.<\/p>\n<h3>Kullan\u0131m \u00d6rnekleri<\/h3>\n<p>A\u015fa\u011f\u0131daki \u00f6rnek, &#8220;google.com&#8221; gibi bir hostname i\u00e7in <code>gethostbyname_ex()<\/code> fonksiyonunun nas\u0131l kullan\u0131ld\u0131\u011f\u0131n\u0131 ve d\u00f6nd\u00fcrd\u00fc\u011f\u00fc bilgileri g\u00f6sterir:<\/p>\n<pre><code class=\"language-python\">import socket\n\ntry:\n    hostname = \"google.com\"\n    canonical_name, aliases, ip_addresses = socket.gethostbyname_ex(hostname)\n\n    print(f\"Sorgulanan Hostname: {hostname}\")\n    print(f\"Resmi Hostname (Canonical Name): {canonical_name}\")\n    print(f\"Alias Listesi: {aliases}\")\n    print(f\"IP Adresleri Listesi: {ip_addresses}\")\n\n    print(\"\\n--- Ba\u015fka bir \u00f6rnek: www.python.org ---\")\n    hostname = \"www.python.org\"\n    canonical_name, aliases, ip_addresses = socket.gethostbyname_ex(hostname)\n\n    print(f\"Sorgulanan Hostname: {hostname}\")\n    print(f\"Resmi Hostname (Canonical Name): {canonical_name}\")\n    print(f\"Alias Listesi: {aliases}\")\n    print(f\"IP Adresleri Listesi: {ip_addresses}\")\n\nexcept socket.gaierror as e:\n    print(f\"Hata olu\u015ftu: {e}\")\nexcept Exception as e:\n    print(f\"Beklenmedik bir hata olu\u015ftu: {e}\")<\/code><\/pre>\n<p>Bu \u00f6rnekte, <code>www.python.org<\/code> i\u00e7in genellikle <code>canonical_name<\/code> olarak <code>python.org<\/code> veya benzeri bir de\u011fer, <code>aliases<\/code> olarak bo\u015f bir liste (veya bazen farkl\u0131 bir alias) ve birden fazla IP adresi i\u00e7eren bir <code>ip_addresses<\/code> listesi d\u00f6nebilir.<\/p>\n<h3>Alias Kavram\u0131n\u0131n A\u00e7\u0131klanmas\u0131<\/h3>\n<p>Alias (takma ad), bir hostname&#8217;in birden fazla isme sahip olabilece\u011fi veya bir ismin ba\u015fka bir isme y\u00f6nlendirildi\u011fi durumu ifade eder. DNS kay\u0131tlar\u0131nda CNAME (Canonical Name) kay\u0131tlar\u0131 ile tan\u0131mlan\u0131r. \u00d6rne\u011fin, &#8220;www.example.com&#8221; bir CNAME kayd\u0131 olabilir ve &#8220;example.com&#8221; adresine i\u015faret edebilir. Bu durumda, &#8220;www.example.com&#8221; i\u00e7in sorgulama yap\u0131ld\u0131\u011f\u0131nda, <code>gethostbyname_ex()<\/code> fonksiyonu <code>alias_list<\/code> i\u00e7inde &#8220;www.example.com&#8221;u veya ilgili di\u011fer takma adlar\u0131 d\u00f6nd\u00fcrebilirken, <code>canonical_hostname<\/code> olarak &#8220;example.com&#8221;u g\u00f6sterebilir.<\/p>\n<p><code>gethostbyname_ex()<\/code> fonksiyonu, <code>gethostbyname()<\/code>&#8216;e g\u00f6re daha fazla bilgi sa\u011flad\u0131\u011f\u0131 ve \u00f6zellikle birden fazla IP adresini alabilme yetene\u011fi sayesinde daha kullan\u0131\u015fl\u0131d\u0131r. Ancak, t\u0131pk\u0131 <code>gethostbyname()<\/code> gibi, bu fonksiyon da sadece IPv4 adreslerini destekler. IPv6 adresleri ve daha geli\u015fmi\u015f sorgulama se\u00e7enekleri i\u00e7in <code>getaddrinfo()<\/code> fonksiyonuna ihtiya\u00e7 duyulur.<\/p>\n<h2><code>socket.getaddrinfo()<\/code> ile Geli\u015fmi\u015f \u00c7\u00f6z\u00fcmleme<\/h2>\n<p><code>socket.getaddrinfo()<\/code> fonksiyonu, Python&#8217;da hostname \u00e7\u00f6z\u00fcmleme i\u00e7in en esnek, en g\u00fc\u00e7l\u00fc ve \u00f6nerilen y\u00f6ntemdir. Hem IPv4 hem de IPv6 adreslerini destekler, farkl\u0131 soket tiplerini (TCP, UDP) ve protokolleri belirleme imkan\u0131 sunar ve daha fazla yap\u0131land\u0131rma se\u00e7ene\u011fi sunar.<\/p>\n<h3>Fonksiyonun Tan\u0131m\u0131 ve \u0130mzas\u0131<\/h3>\n<p><code>socket.getaddrinfo(host, port, family=0, type=0, proto=0, flags=0)<\/code>: Verilen <code>host<\/code> (hostname veya IP adresi) ve <code>port<\/code> (port numaras\u0131 veya servis ad\u0131) i\u00e7in a\u011f adres bilgisi tuple&#8217;lar\u0131ndan olu\u015fan bir liste d\u00f6nd\u00fcr\u00fcr.<\/p>\n<p>D\u00f6nen her tuple \u015fu formatta olacakt\u0131r: <code>(family, type, proto, canonname, sockaddr)<\/code>.<br \/>\n*   <code>family<\/code>: Adres ailesi (\u00f6rne\u011fin <code>socket.AF_INET<\/code> for IPv4, <code>socket.AF_INET6<\/code> for IPv6, <code>socket.AF_UNSPEC<\/code> for unspecified).<br \/>\n*   <code>type<\/code>: Soket tipi (\u00f6rne\u011fin <code>socket.SOCK_STREAM<\/code> for TCP, <code>socket.SOCK_DGRAM<\/code> for UDP).<br \/>\n*   <code>proto<\/code>: Protokol numaras\u0131 (\u00f6rne\u011fin <code>socket.IPPROTO_TCP<\/code>, <code>socket.IPPROTO_UDP<\/code>).<br \/>\n*   <code>canonname<\/code>: Hostname&#8217;in resmi (canonical) ad\u0131. <code>AI_CANONNAME<\/code> bayra\u011f\u0131 belirtilirse doldurulur.<br \/>\n*   <code>sockaddr<\/code>: Soket adres bilgisi. IPv4 i\u00e7in <code>(ip_address, port)<\/code> tuple&#8217;\u0131, IPv6 i\u00e7in <code>(ip_address, port, flowinfo, scopeid)<\/code> tuple&#8217;\u0131d\u0131r.<\/p>\n<h3>Parametrelerin A\u00e7\u0131klamas\u0131<\/h3>\n<p>*   <code>host<\/code>: \u00c7\u00f6z\u00fcmlenecek hostname (string) veya IP adresi (string).<br \/>\n*   <code>port<\/code>: Ba\u011flan\u0131lacak port numaras\u0131 (integer) veya servis ad\u0131 (string, \u00f6rn. &#8220;http&#8221;, &#8220;ftp&#8221;). E\u011fer sadece IP adresleri isteniyorsa <code>None<\/code> veya <code>0<\/code> olarak ayarlanabilir.<br \/>\n*   <code>family<\/code>: \u0130stenen adres ailesini belirler. Varsay\u0131lan olarak <code>0<\/code> (<code>AF_UNSPEC<\/code>), yani hem IPv4 hem de IPv6 adreslerini d\u00f6nd\u00fcrmeye \u00e7al\u0131\u015f\u0131r.<br \/>\n    *   <code>socket.AF_INET<\/code>: Sadece IPv4 adresleri.<br \/>\n    *   <code>socket.AF_INET6<\/code>: Sadece IPv6 adresleri.<br \/>\n    *   <code>socket.AF_UNSPEC<\/code>: Hem IPv4 hem de IPv6 adresleri (tercih edilen).<br \/>\n*   <code>type<\/code>: \u0130stenen soket tipini belirler. Varsay\u0131lan <code>0<\/code> (<code>SOCK_STREAM<\/code> veya <code>SOCK_DGRAM<\/code> i\u00e7in esnek).<br \/>\n    *   <code>socket.SOCK_STREAM<\/code>: TCP soketleri (g\u00fcvenilir, ba\u011flant\u0131 tabanl\u0131).<br \/>\n    *   <code>socket.SOCK_DGRAM<\/code>: UDP soketleri (g\u00fcvenilmez, ba\u011flant\u0131s\u0131z).<br \/>\n*   <code>proto<\/code>: \u0130stenen protokol\u00fc belirler. Varsay\u0131lan <code>0<\/code> (herhangi bir protokol). Genellikle <code>type<\/code> ile birlikte kullan\u0131l\u0131r (\u00f6rn. <code>socket.IPPROTO_TCP<\/code>).<br \/>\n*   <code>flags<\/code>: \u00c7\u00f6z\u00fcmleme davran\u0131\u015f\u0131n\u0131 de\u011fi\u015ftiren bayraklar. Birden fazla bayrak bitwise OR (<code>|<\/code>) ile birle\u015ftirilebilir.<br \/>\n    *   <code>socket.AI_CANONNAME<\/code>: <code>canonname<\/code> alan\u0131n\u0131n doldurulmas\u0131n\u0131 sa\u011flar.<br \/>\n    *   <code>socket.AI_PASSIVE<\/code>: Soket sunucu olarak kullan\u0131lacaksa, <code>host<\/code> bo\u015f b\u0131rak\u0131labilir ve yerel aray\u00fcz adresleri d\u00f6nd\u00fcr\u00fcl\u00fcr (genellikle <code>0.0.0.0<\/code> veya <code>::<\/code>).<br \/>\n    *   <code>socket.AI_NUMERICHOST<\/code>: E\u011fer <code>host<\/code> bir say\u0131sal IP adresi de\u011filse hata f\u0131rlat\u0131r. DNS \u00e7\u00f6z\u00fcmlemesini engeller.<br \/>\n    *   <code>socket.AI_NUMERICSERV<\/code>: E\u011fer <code>port<\/code> bir say\u0131sal port de\u011filse hata f\u0131rlat\u0131r. Servis ad\u0131 \u00e7\u00f6z\u00fcmlemesini engeller.<br \/>\n    *   <code>socket.AI_ADDRCONFIG<\/code>: Yaln\u0131zca sistemde yap\u0131land\u0131r\u0131lm\u0131\u015f adres tiplerini d\u00f6nd\u00fcr\u00fcr. \u00d6rne\u011fin, sistemde IPv6 yap\u0131land\u0131r\u0131lmam\u0131\u015fsa IPv6 adreslerini d\u00f6nd\u00fcrmez.<\/p>\n<h3>Kullan\u0131m \u00d6rnekleri<\/h3>\n<h4>Basit \u00c7\u00f6z\u00fcmleme (IPv4 ve IPv6)<\/h4>\n<pre><code class=\"language-python\">import socket\n\ntry:\n    hostname = \"example.com\"\n    # Portu None yaparak sadece IP adreslerini alabiliriz.\n    # family=socket.AF_UNSPEC ile hem IPv4 hem IPv6'y\u0131 dener\n    addr_info = socket.getaddrinfo(hostname, None, family=socket.AF_UNSPEC)\n\n    print(f\"'{hostname}' i\u00e7in adres bilgileri:\")\n    for res in addr_info:\n        family, type, proto, canonname, sockaddr = res\n        print(f\"  Family: {family} ({'IPv4' if family == socket.AF_INET else 'IPv6' if family == socket.AF_INET6 else 'Di\u011fer'})\")\n        print(f\"  Type: {type} ({'STREAM' if type == socket.SOCK_STREAM else 'DGRAM' if type == socket.SOCK_DGRAM else 'Di\u011fer'})\")\n        print(f\"  Protocol: {proto}\")\n        print(f\"  Canonical Name: {canonname}\")\n        print(f\"  Sockaddr: {sockaddr}\")\n        print(\"-\" * 20)\n\nexcept socket.gaierror as e:\n    print(f\"Hata olu\u015ftu: {e}\")\nexcept Exception as e:\n    print(f\"Beklenmedik bir hata olu\u015ftu: {e}\")<\/code><\/pre>\n<h4>Sadece IPv4 Adresleri i\u00e7in<\/h4>\n<pre><code class=\"language-python\">import socket\n\ntry:\n    hostname = \"google.com\"\n    addr_info_ipv4 = socket.getaddrinfo(hostname, 80, family=socket.AF_INET, type=socket.SOCK_STREAM)\n    print(f\"'{hostname}' (IPv4, TCP, Port 80) i\u00e7in adres bilgileri:\")\n    for res in addr_info_ipv4:\n        print(f\"  Sockaddr: {res[4]}\")\nexcept socket.gaierror as e:\n    print(f\"Hata olu\u015ftu: {e}\")<\/code><\/pre>\n<h4>Sadece IPv6 Adresleri i\u00e7in<\/h4>\n<pre><code class=\"language-python\">import socket\n\ntry:\n    hostname = \"google.com\"\n    addr_info_ipv6 = socket.getaddrinfo(hostname, 443, family=socket.AF_INET6, type=socket.SOCK_STREAM)\n    print(f\"'{hostname}' (IPv6, TCP, Port 443) i\u00e7in adres bilgileri:\")\n    for res in addr_info_ipv6:\n        print(f\"  Sockaddr: {res[4]}\")\nexcept socket.gaierror as e:\n    print(f\"Hata olu\u015ftu: {e}\")<\/code><\/pre>\n<h4>Canonical Name ile Birlikte<\/h4>\n<pre><code class=\"language-python\">import socket\n\ntry:\n    hostname = \"www.python.org\"\n    # AI_CANONNAME bayra\u011f\u0131n\u0131 ekleyerek canonical name'i alabiliriz\n    addr_info_canon = socket.getaddrinfo(hostname, None, flags=socket.AI_CANONNAME)\n    print(f\"'{hostname}' i\u00e7in Canonical Name ile adres bilgileri:\")\n    for res in addr_info_canon:\n        print(f\"  Canonical Name: {res[3]}, Sockaddr: {res[4]}\")\nexcept socket.gaierror as e:\n    print(f\"Hata olu\u015ftu: {e}\")<\/code><\/pre>\n<p><code>getaddrinfo()<\/code> fonksiyonu, a\u011f uygulamalar\u0131nda hostname \u00e7\u00f6z\u00fcmlemesi i\u00e7in en modern ve g\u00fcvenli yakla\u015f\u0131md\u0131r. Hem IPv4 hem de IPv6 uyumlulu\u011fu, farkl\u0131 protokol ve soket tipi deste\u011fi, ve detayl\u0131 bilgi edinme imkan\u0131 sayesinde, karma\u015f\u0131k a\u011f senaryolar\u0131nda vazge\u00e7ilmez bir ara\u00e7t\u0131r.<\/p>\n<h2>IPv4 ve IPv6 Adresleri<\/h2>\n<p>\u0130nternet Protokol\u00fc&#8217;n\u00fcn (IP) iki ana s\u00fcr\u00fcm\u00fc vard\u0131r: IPv4 ve IPv6. Her ikisi de a\u011f \u00fczerindeki cihazlar\u0131 benzersiz bir \u015fekilde tan\u0131mlamak i\u00e7in kullan\u0131l\u0131r, ancak \u00f6nemli farkl\u0131l\u0131klar\u0131 vard\u0131r.<\/p>\n<h3>IPv4<\/h3>\n<p>IPv4 adresleri 32 bit uzunlu\u011fundad\u0131r ve genellikle d\u00f6rt sekizlik gruptan olu\u015fan onluk say\u0131larla (noktalarla ayr\u0131lm\u0131\u015f) ifade edilir, \u00f6rne\u011fin &#8220;192.168.1.1&#8221;. Yakla\u015f\u0131k 4.3 milyar benzersiz adres sunar. Ancak, internetin h\u0131zla b\u00fcy\u00fcmesiyle birlikte bu adres alan\u0131 t\u00fckenmeye ba\u015flam\u0131\u015ft\u0131r.<\/p>\n<h3>IPv6<\/h3>\n<p>IPv6, IPv4&#8217;\u00fcn adres t\u00fckenmesi sorununu \u00e7\u00f6zmek i\u00e7in geli\u015ftirilmi\u015ftir. 128 bit uzunlu\u011fundad\u0131r ve sekiz adet d\u00f6rtl\u00fc onalt\u0131l\u0131k say\u0131 grubundan olu\u015fur, iki nokta \u00fcst \u00fcste ile ayr\u0131l\u0131r, \u00f6rne\u011fin &#8220;2001:0db8:85a3:0000:0000:8a2e:0370:7334&#8221;. \u00c7ok daha geni\u015f bir adres alan\u0131 sunar (yakla\u015f\u0131k 3.4 x 10^38 benzersiz adres).<\/p>\n<h3>Python&#8217;da IPv4 ve IPv6 Deste\u011fi<\/h3>\n<p>Python&#8217;\u0131n <code>socket<\/code> mod\u00fcl\u00fc, hem IPv4 hem de IPv6 adreslerini do\u011fal olarak destekler.<br \/>\n*   <code>socket.gethostbyname()<\/code> ve <code>socket.gethostbyname_ex()<\/code> sadece IPv4 adreslerini d\u00f6nd\u00fcr\u00fcr.<br \/>\n*   <code>socket.getaddrinfo()<\/code> ise <code>family<\/code> parametresi sayesinde hem IPv4 (<code>socket.AF_INET<\/code>) hem de IPv6 (<code>socket.AF_INET6<\/code>) adreslerini veya her ikisini birden (<code>socket.AF_UNSPEC<\/code>) \u00e7\u00f6z\u00fcmleyebilir. Bu, uygulamalar\u0131n\u0131z\u0131n gelecekteki a\u011f altyap\u0131s\u0131 de\u011fi\u015fikliklerine uyum sa\u011flamas\u0131 i\u00e7in kritik \u00f6neme sahiptir.<\/p>\n<p>IPv4 ve IPv6 adresleri aras\u0131ndaki d\u00f6n\u00fc\u015f\u00fcmler veya adreslerin okunabilir formatlara \u00e7evrilmesi i\u00e7in <code>socket.inet_ntop()<\/code> (numeric to presentation) ve <code>socket.inet_pton()<\/code> (presentation to numeric) gibi fonksiyonlar da mevcuttur. Ancak, <code>getaddrinfo()<\/code> \u00e7o\u011fu durumda bu d\u00f6n\u00fc\u015f\u00fcmleri sizin i\u00e7in otomatik olarak halleder ve <code>sockaddr<\/code> tuple&#8217;\u0131nda uygun formatta IP adresini sa\u011flar.<\/p>\n<h2>Hata Y\u00f6netimi ve \u00d6zel Durumlar<\/h2>\n<p>Hostname \u00e7\u00f6z\u00fcmleme i\u015flemleri, a\u011f ba\u011f\u0131ml\u0131l\u0131klar\u0131 nedeniyle \u00e7e\u015fitli hatalarla kar\u015f\u0131la\u015fabilir. Bu hatalar\u0131 do\u011fru bir \u015fekilde ele almak, uygulamalar\u0131n\u0131z\u0131n sa\u011flaml\u0131\u011f\u0131n\u0131 art\u0131r\u0131r. Python&#8217;da <code>socket<\/code> mod\u00fcl\u00fc, belirli hata durumlar\u0131 i\u00e7in \u00f6zel istisnalar tan\u0131mlar.<\/p>\n<h3>Ana Hata Tipleri<\/h3>\n<p>1.  <strong><code>socket.gaierror<\/code> (getaddrinfo error):<\/strong> <code>getaddrinfo()<\/code>, <code>gethostbyname()<\/code>, <code>gethostbyname_ex()<\/code> gibi fonksiyonlar taraf\u0131ndan bir hostname \u00e7\u00f6z\u00fcmlenemedi\u011finde veya bir a\u011f hatas\u0131 olu\u015ftu\u011funda f\u0131rlat\u0131lan genel bir hatad\u0131r. Bu, en s\u0131k kar\u015f\u0131la\u015faca\u011f\u0131n\u0131z hata t\u00fcr\u00fcd\u00fcr.<br \/>\n    *   <strong>Nedenleri:<\/strong><br \/>\n        *   Bilinmeyen hostname (DNS kayd\u0131 yok).<br \/>\n        *   Ge\u00e7ersiz hostname format\u0131.<br \/>\n        *   DNS sunucusuna ula\u015f\u0131lamamas\u0131 (a\u011f ba\u011flant\u0131s\u0131 sorunu, DNS sunucusunun kapal\u0131 olmas\u0131).<br \/>\n        *   DNS sunucusunun yan\u0131t vermemesi.<br \/>\n2.  <strong><code>socket.herror<\/code> (host error):<\/strong> Bu hata, daha eski olan <code>gethostbyname()<\/code> ve <code>gethostbyname_ex()<\/code> fonksiyonlar\u0131na \u00f6zg\u00fcd\u00fcr ve genellikle <code>socket.gaierror<\/code> ile ayn\u0131 durumlar i\u00e7in f\u0131rlat\u0131l\u0131r. Modern Python&#8217;da <code>gaierror<\/code> daha genel ve tercih edilen hata tipidir.<br \/>\n3.  <strong><code>socket.error<\/code>:<\/strong> Daha genel bir soket hatas\u0131d\u0131r. Di\u011fer \u00f6zel <code>socket<\/code> hatalar\u0131n\u0131 kapsayan bir \u00fcst s\u0131n\u0131ft\u0131r. Genellikle a\u011f ile ilgili daha d\u00fc\u015f\u00fck seviyeli sorunlarda (\u00f6rne\u011fin soket olu\u015fturma veya ba\u011flama hatalar\u0131) ortaya \u00e7\u0131kabilir.<\/p>\n<h3><code>try-except<\/code> Bloklar\u0131n\u0131n Kullan\u0131m\u0131<\/h3>\n<p>Hostname \u00e7\u00f6z\u00fcmleme kodunuzu her zaman bir <code>try-except<\/code> blo\u011fu i\u00e7ine alman\u0131z \u015fiddetle tavsiye edilir. Bu, uygulaman\u0131z\u0131n beklenmedik a\u011f sorunlar\u0131 veya ge\u00e7ersiz giri\u015fler nedeniyle \u00e7\u00f6kmesini engeller.<\/p>\n<pre><code class=\"language-python\">import socket\n\ndef resolve_hostname(hostname):\n    try:\n        # getaddrinfo'yu tercih ediyoruz \u00e7\u00fcnk\u00fc daha esnek ve hem IPv4 hem IPv6'y\u0131 destekliyor\n        addr_info = socket.getaddrinfo(hostname, None, family=socket.AF_UNSPEC)\n        \n        ip_addresses = []\n        for res in addr_info:\n            family, type, proto, canonname, sockaddr = res\n            # sockaddr'\u0131n ilk eleman\u0131 IP adresidir\n            ip_addresses.append(sockaddr[0])\n        \n        # Tekrarlayan IP adreslerini temizle ve sadece benzersiz olanlar\u0131 d\u00f6nd\u00fcr\n        return list(set(ip_addresses))\n\n    except socket.gaierror as e:\n        # getaddrinfo, gethostbyname, gethostbyname_ex hatalar\u0131 i\u00e7in\n        if e.errno == socket.EAI_NONAME: # Hostname bulunamad\u0131\n            print(f\"Hata: '{hostname}' i\u00e7in DNS kayd\u0131 bulunamad\u0131. L\u00fctfen hostname'i kontrol edin.\")\n        elif e.errno == socket.EAI_AGAIN: # Ge\u00e7ici hata, tekrar denenebilir\n            print(f\"Hata: DNS sunucusu ge\u00e7ici olarak me\u015fgul veya yan\u0131t vermiyor. L\u00fctfen daha sonra tekrar deneyin.\")\n        elif e.errno == socket.EAI_FAIL: # Kal\u0131c\u0131 DNS hatas\u0131\n            print(f\"Hata: DNS \u00e7\u00f6z\u00fcmlemesi kal\u0131c\u0131 olarak ba\u015far\u0131s\u0131z oldu. DNS sunucusu hatas\u0131.\")\n        else:\n            print(f\"Bir a\u011f hatas\u0131 olu\u015ftu: {e}\")\n        return []\n    except Exception as e:\n        # Di\u011fer beklenmedik hatalar i\u00e7in\n        print(f\"Beklenmedik bir hata olu\u015ftu: {e}\")\n        return []\n\n<h2>Test senaryolar\u0131<\/h2>\nprint(f\"Google.com IP'leri: {resolve_hostname('google.com')}\")\nprint(f\"Localhost IP'leri: {resolve_hostname('localhost')}\")\nprint(f\"Bilinmeyen Hostname IP'leri: {resolve_hostname('nonexistent-domain-12345.com')}\")\nprint(f\"Ge\u00e7ersiz Hostname IP'leri: {resolve_hostname('invalid_host_name!')}\")<\/code><\/pre>\n<p>Yukar\u0131daki \u00f6rnekte, <code>socket.gaierror<\/code> i\u00e7indeki <code>errno<\/code> \u00f6zniteli\u011fi, hatan\u0131n nedenini daha spesifik olarak belirlemek i\u00e7in kullan\u0131labilir. Baz\u0131 yayg\u0131n <code>EAI_<\/code> hata kodlar\u0131:<br \/>\n*   <code>EAI_NONAME<\/code>: Hostname veya servis bilinmiyor.<br \/>\n*   <code>EAI_AGAIN<\/code>: Ge\u00e7ici hata, DNS sunucusu me\u015fgul veya yan\u0131t vermiyor.<br \/>\n*   <code>EAI_FAIL<\/code>: DNS \u00e7\u00f6z\u00fcmlemesi kal\u0131c\u0131 olarak ba\u015far\u0131s\u0131z oldu.<br \/>\n*   <code>EAI_NODATA<\/code>: \u0130stenen t\u00fcrde kay\u0131t bulunamad\u0131 (\u00f6rn. sadece IPv6 istendi ama sadece IPv4 var).<\/p>\n<p>Do\u011fru hata y\u00f6netimi, uygulaman\u0131z\u0131n kullan\u0131c\u0131lar i\u00e7in daha iyi bir deneyim sunmas\u0131n\u0131 ve sorun gidermeyi kolayla\u015ft\u0131rmas\u0131n\u0131 sa\u011flar.<\/p>\n<h2>Performans ve \u00d6nbellekleme<\/h2>\n<p>DNS \u00e7\u00f6z\u00fcmlemesi, a\u011f \u00fczerinden yap\u0131lan bir i\u015flem oldu\u011fu i\u00e7in belirli bir gecikmeye (latency) sahiptir. B\u00fcy\u00fck \u00f6l\u00e7ekli uygulamalarda veya s\u0131k s\u0131k hostname \u00e7\u00f6z\u00fcmlemesi gerektiren durumlarda, bu gecikmeler performans\u0131 olumsuz etkileyebilir. Bu nedenle, performans optimizasyonu ve \u00f6nbellekleme stratejileri \u00f6nemlidir.<\/p>\n<h3>\u0130\u015fletim Sistemi D\u00fczeyinde DNS \u00d6nbellekleme<\/h3>\n<p>Modern i\u015fletim sistemleri, DNS sorgular\u0131n\u0131n sonu\u00e7lar\u0131n\u0131 kendi i\u00e7 \u00f6nbelleklerinde saklar. Bir hostname ilk kez \u00e7\u00f6z\u00fcmlendi\u011finde, sonu\u00e7 i\u015fletim sistemi \u00f6nbelle\u011fine al\u0131n\u0131r. Ayn\u0131 hostname i\u00e7in yap\u0131lan sonraki sorgular, \u00f6nbellekten h\u0131zl\u0131 bir \u015fekilde yan\u0131tlan\u0131r ve a\u011f trafi\u011fi olu\u015fmaz. Bu \u00f6nbelle\u011fin ge\u00e7erlilik s\u00fcresi, DNS kay\u0131tlar\u0131n\u0131n TTL (Time To Live) de\u011feri ile belirlenir. Bu, \u00e7o\u011fu durumda performans\u0131 otomatik olarak art\u0131r\u0131r.<\/p>\n<h3>Python Taraf\u0131nda Manuel \u00d6nbellekleme Stratejileri<\/h3>\n<p>Baz\u0131 durumlarda, i\u015fletim sistemi \u00f6nbelle\u011fi yeterli olmayabilir veya uygulaman\u0131z\u0131n daha spesifik \u00f6nbellekleme ihtiya\u00e7lar\u0131 olabilir. Python taraf\u0131nda manuel \u00f6nbellekleme uygulamak m\u00fcmk\u00fcnd\u00fcr.<\/p>\n<h4><code>functools.lru_cache<\/code> Kullan\u0131m\u0131<\/h4>\n<p>Python 3.2 ve sonraki s\u00fcr\u00fcmlerde bulunan <code>functools.lru_cache<\/code> dekorat\u00f6r\u00fc, fonksiyon \u00e7a\u011fr\u0131lar\u0131n\u0131n sonu\u00e7lar\u0131n\u0131 \u00f6nbelle\u011fe almak i\u00e7in m\u00fckemmel bir ara\u00e7t\u0131r. LRU (Least Recently Used) algoritmas\u0131n\u0131 kullanarak, en az kullan\u0131lan \u00f6\u011feleri \u00f6nbellekten atar.<\/p>\n<pre><code class=\"language-python\">import socket\nfrom functools import lru_cache\n\n@lru_cache(maxsize=128) # Son 128 farkl\u0131 hostname'in sonu\u00e7lar\u0131n\u0131 \u00f6nbelle\u011fe al\ndef get_ip_addresses_cached(hostname):\n    \"\"\"\n    Hostname i\u00e7in IP adreslerini \u00f6nbelle\u011fe alarak d\u00f6nd\u00fcren fonksiyon.\n    \"\"\"\n    try:\n        # getaddrinfo'yu kullanarak hem IPv4 hem IPv6 adreslerini al\n        addr_info = socket.getaddrinfo(hostname, None, family=socket.AF_UNSPEC)\n        \n        ip_addresses = []\n        for res in addr_info:\n            sockaddr = res[4]\n            ip_addresses.append(sockaddr[0])\n        \n        # Sadece benzersiz IP adreslerini d\u00f6nd\u00fcr\n        return tuple(sorted(list(set(ip_addresses)))) # \u00d6nbellekleme i\u00e7in tuple'a \u00e7eviriyoruz\n\n    except socket.gaierror as e:\n        print(f\"Hata: '{hostname}' \u00e7\u00f6z\u00fcmlenemedi: {e}\")\n        return tuple() # Hata durumunda bo\u015f tuple d\u00f6nd\u00fcr\n    except Exception as e:\n        print(f\"Beklenmedik bir hata olu\u015ftu: {e}\")\n        return tuple()\n\n<h2>Test<\/h2>\nprint(\"\u0130lk sorgu (\u00f6nbelle\u011fe al\u0131nacak):\")\nprint(f\"Google.com IP'leri: {get_ip_addresses_cached('google.com')}\")\nprint(f\"Python.org IP'leri: {get_ip_addresses_cached('python.org')}\")\n\nprint(\"\\n\u0130kinci sorgu (\u00f6nbellekten al\u0131nacak):\")\nprint(f\"Google.com IP'leri: {get_ip_addresses_cached('google.com')}\") # Bu \u00e7a\u011fr\u0131 daha h\u0131zl\u0131 olacakt\u0131r\n\nprint(\"\\n\u00d6nbellek istatistikleri:\")\nprint(get_ip_addresses_cached.cache_info())\n\n<h2>\u00d6nbellekte olmayan bir hostname<\/h2>\nprint(f\"\\nBilinmeyen Hostname IP'leri: {get_ip_addresses_cached('nonexistent-domain-12345.com')}\")\nprint(get_ip_addresses_cached.cache_info())<\/code><\/pre>\n<p><code>lru_cache<\/code> dekorat\u00f6r\u00fc, ayn\u0131 arg\u00fcmanlarla yap\u0131lan sonraki \u00e7a\u011fr\u0131lar i\u00e7in fonksiyonu tekrar \u00e7al\u0131\u015ft\u0131rmak yerine, \u00f6nbellekteki sonucu d\u00f6nd\u00fcr\u00fcr. Bu, a\u011f \u00e7a\u011fr\u0131lar\u0131n\u0131n tekrar tekrar yap\u0131lmas\u0131n\u0131 engelleyerek performans\u0131 \u00f6nemli \u00f6l\u00e7\u00fcde art\u0131r\u0131r. <code>maxsize<\/code> parametresi, \u00f6nbellekte tutulacak maksimum \u00f6\u011fe say\u0131s\u0131n\u0131 belirler.<\/p>\n<h3>Tekrarlayan Sorgulardan Ka\u00e7\u0131nma<\/h3>\n<p>Uygulaman\u0131z\u0131n tasar\u0131m\u0131nda, ayn\u0131 hostname i\u00e7in gereksiz yere birden fazla \u00e7\u00f6z\u00fcmleme yapmaktan ka\u00e7\u0131nmak \u00f6nemlidir. Bir kez \u00e7\u00f6z\u00fcmlenen bir IP adresi, uygulaman\u0131z\u0131n ya\u015fam d\u00f6ng\u00fcs\u00fc boyunca veya belirli bir s\u00fcre boyunca kullan\u0131labilir. Ancak, DNS kay\u0131tlar\u0131n\u0131n de\u011fi\u015febilece\u011fi g\u00f6z \u00f6n\u00fcnde bulundurularak, \u00f6nbellekteki bilgilerin s\u00fcresi doldu\u011funda (TTL) veya belirli aral\u0131klarla yenilenmesi gerekebilir. <code>lru_cache<\/code> bu yenileme i\u015flemini do\u011frudan y\u00f6netmez; \u00f6nbelle\u011fe al\u0131nan de\u011ferler, <code>maxsize<\/code> a\u015f\u0131ld\u0131\u011f\u0131nda veya manuel olarak <code>cache_clear()<\/code> ile temizlenene kadar kal\u0131r. Daha dinamik \u00f6nbellekleme i\u00e7in, kendi \u00f6zel \u00f6nbellekleme mekanizman\u0131z\u0131 TTL de\u011ferlerini g\u00f6z \u00f6n\u00fcnde bulundurarak uygulayabilirsiniz.<\/p>\n<h2>Kullan\u0131m Senaryolar\u0131 ve Pratik Uygulamalar<\/h2>\n<p>Hostname&#8217;den IP adresi \u00e7\u00f6z\u00fcmleme yetene\u011fi, \u00e7e\u015fitli a\u011f uygulamalar\u0131 ve sistem y\u00f6netimi g\u00f6revleri i\u00e7in temel bir yap\u0131 ta\u015f\u0131d\u0131r.<\/p>\n<h3>A\u011f \u0130zleme ve Tan\u0131lama Ara\u00e7lar\u0131<\/h3>\n<p>*   <strong>Ping ve Traceroute Benzeri Ara\u00e7lar:<\/strong> Bir hostname&#8217;in IP adresini \u00e7\u00f6zerek, o adrese ping atma veya traceroute (yol izleme) yaparak a\u011f ba\u011flant\u0131s\u0131n\u0131 ve gecikmeyi kontrol edebilirsiniz.<br \/>\n*   <strong>A\u011f Envanteri:<\/strong> Bir a\u011fdaki cihazlar\u0131n hostname&#8217;lerini IP adreslerine \u00e7evirerek, a\u011f cihazlar\u0131n\u0131n ve sunucular\u0131n\u0131n envanterini olu\u015fturmak ve y\u00f6netmek.<\/p>\n<h3>G\u00fcvenlik Taray\u0131c\u0131lar\u0131 ve Penetrasyon Testleri<\/h3>\n<p>*   <strong>Alt Alan Ad\u0131 Ke\u015ffi (Subdomain Enumeration):<\/strong> Bir ana alan ad\u0131 i\u00e7in olas\u0131 alt alan adlar\u0131n\u0131 (\u00f6rn. mail.example.com, dev.example.com) \u00e7\u00f6zmeye \u00e7al\u0131\u015farak bir hedefin t\u00fcm g\u00f6r\u00fcn\u00fcr y\u00fczeyini haritalamak.<br \/>\n*   <strong>IP Tabanl\u0131 Eri\u015fim Kontrol\u00fc:<\/strong> Belirli bir hostname&#8217;e kar\u015f\u0131l\u0131k gelen IP adreslerini alarak, g\u00fcvenlik duvar\u0131 kurallar\u0131 veya eri\u015fim kontrol listeleri olu\u015fturmak.<br \/>\n*   <strong>Alan Ad\u0131 Sahibi Bilgisi:<\/strong> Bir alan ad\u0131n\u0131n IP adresini \u00e7\u00f6zd\u00fckten sonra, bu IP adresinin kime ait oldu\u011funu (WHOIS sorgusu ile) bulmak ve olas\u0131 k\u00f6t\u00fc niyetli faaliyetleri ara\u015ft\u0131rmak.<\/p>\n<h3>Web Sunucusu ve Uygulama Yap\u0131land\u0131rmas\u0131<\/h3>\n<p>*   <strong>Uygulama \u0130\u00e7i Ba\u011flant\u0131 Do\u011frulama:<\/strong> Bir veritaban\u0131 sunucusuna, API hizmetine veya harici bir kayna\u011fa ba\u011flanmadan \u00f6nce hostname&#8217;ini IP adresine \u00e7evirerek ba\u011flant\u0131n\u0131n ge\u00e7erlili\u011fini kontrol etmek.<br \/>\n*   <strong>Y\u00fck Dengeleme ve Failover:<\/strong> Birden fazla IP adresini \u00e7\u00f6zerek, uygulama trafi\u011fini bu adresler aras\u0131nda da\u011f\u0131tmak veya bir IP adresinin ba\u015far\u0131s\u0131z olmas\u0131 durumunda di\u011ferine ge\u00e7mek.<br \/>\n*   <strong>Dinamik DNS G\u00fcncellemesi:<\/strong> Kendi DNS sunucunuzu veya dinamik DNS hizmetini kullan\u0131yorsan\u0131z, uygulaman\u0131z\u0131n g\u00fcncel IP adresini DNS kay\u0131tlar\u0131na kaydetmek.<\/p>\n<h3>API Entegrasyonlar\u0131 ve Mikroservisler<\/h3>\n<p>*   <strong>Servis Ke\u015ffi:<\/strong> Mikroservis mimarilerinde, bir servisin hostname&#8217;ini kullanarak o servisin g\u00fcncel IP adreslerini bulmak ve ileti\u015fim kurmak.<br \/>\n*   <strong>Harici API \u00c7a\u011fr\u0131lar\u0131:<\/strong> \u00dc\u00e7\u00fcnc\u00fc taraf bir API&#8217;ye ba\u011flan\u0131rken, API&#8217;nin hostname&#8217;ini IP adresine \u00e7evirerek do\u011frudan IP \u00fczerinden ba\u011flant\u0131 kurmak (baz\u0131 durumlarda g\u00fcvenlik veya performans i\u00e7in tercih edilebilir).<\/p>\n<h3>Veri Merkezleri ve Bulut Ortamlar\u0131<\/h3>\n<p>*   <strong>Otomatik Da\u011f\u0131t\u0131m ve Yap\u0131land\u0131rma:<\/strong> Yeni sanal makineler veya konteynerler ba\u015flat\u0131ld\u0131\u011f\u0131nda, onlara atanan hostname&#8217;leri \u00e7\u00f6zerek di\u011fer servislerin bu kaynaklara eri\u015fmesini sa\u011flamak.<br \/>\n*   <strong>A\u011f Topolojisi Haritalama:<\/strong> B\u00fcy\u00fck ve karma\u015f\u0131k a\u011f ortamlar\u0131nda, hostname-IP e\u015fle\u015fmelerini kullanarak a\u011f topolojisini otomatik olarak haritalamak.<\/p>\n<p>Bu senaryolar, Python&#8217;\u0131n <code>socket<\/code> mod\u00fcl\u00fcn\u00fcn hostname \u00e7\u00f6z\u00fcmleme yeteneklerinin ne kadar temel ve yayg\u0131n oldu\u011funu g\u00f6stermektedir. Do\u011fru fonksiyonun se\u00e7ilmesi ve hata y\u00f6netiminin iyi yap\u0131lmas\u0131, bu t\u00fcr uygulamalar\u0131n g\u00fcvenilirli\u011fini ve performans\u0131n\u0131 do\u011frudan etkiler.<\/p>\n<h2>G\u00fcvenlik Konular\u0131<\/h2>\n<p>Hostname&#8217;den IP adresi \u00e7\u00f6z\u00fcmleme i\u015flemi, a\u011f g\u00fcvenli\u011fi a\u00e7\u0131s\u0131ndan baz\u0131 \u00f6nemli konular\u0131 beraberinde getirir. Uygulamalar\u0131n\u0131zda bu fonksiyonlar\u0131 kullan\u0131rken a\u015fa\u011f\u0131daki g\u00fcvenlik endi\u015felerini g\u00f6z \u00f6n\u00fcnde bulundurman\u0131z \u00f6nemlidir:<\/p>\n<h3>DNS Sahtecili\u011fi (Spoofing) ve Zehirlenmesi (Poisoning)<\/h3>\n<p>*   <strong>DNS Sahtecili\u011fi:<\/strong> K\u00f6t\u00fc niyetli bir sald\u0131rgan\u0131n, me\u015fru bir alan ad\u0131 i\u00e7in yanl\u0131\u015f IP adresi d\u00f6nd\u00fcren sahte bir DNS yan\u0131t\u0131 g\u00f6ndermesidir. Bu, kullan\u0131c\u0131lar\u0131 veya uygulamalar\u0131 k\u00f6t\u00fc niyetli bir sunucuya y\u00f6nlendirebilir.<br \/>\n*   <strong>DNS Zehirlenmesi (Cache Poisoning):<\/strong> K\u00f6t\u00fc niyetli verilerin bir DNS \u00e7\u00f6z\u00fcmleyici sunucusunun \u00f6nbelle\u011fine enjekte edilmesiyle ger\u00e7ekle\u015fir. Bu, o sunucuyu kullanan t\u00fcm istemcilerin yanl\u0131\u015f IP adreslerini almas\u0131na neden olur.<\/p>\n<p><strong>Korunma:<\/strong><br \/>\n*   <strong>G\u00fcvenilir DNS Sunucular\u0131 Kullan\u0131m\u0131:<\/strong> Uygulaman\u0131z\u0131n veya i\u015fletim sisteminizin g\u00fcvendi\u011fi, iyi yap\u0131land\u0131r\u0131lm\u0131\u015f ve g\u00fcncel DNS sunucular\u0131n\u0131 kullanmak \u00f6nemlidir. DNSSEC (Domain Name System Security Extensions) kullanan sunucular, DNS yan\u0131tlar\u0131n\u0131n b\u00fct\u00fcnl\u00fc\u011f\u00fcn\u00fc ve orijinalli\u011fini do\u011frulamaya yard\u0131mc\u0131 olabilir.<br \/>\n*   <strong>DNSSEC Do\u011frulamas\u0131:<\/strong> Kendi uygulamalar\u0131n\u0131zda do\u011frudan DNSSEC do\u011frulamas\u0131 yapmak karma\u015f\u0131k olsa da, i\u015fletim sisteminizin veya DNS \u00e7\u00f6z\u00fcmleyicinizin bunu destekledi\u011finden emin olmak \u00f6nemlidir.<\/p>\n<h3>D\u00f6nen IP Adresinin G\u00fcvenilirli\u011fi<\/h3>\n<p><code>socket.gethostbyname()<\/code> veya <code>getaddrinfo()<\/code> gibi fonksiyonlardan d\u00f6nen IP adresine her zaman k\u00f6r\u00fc k\u00f6r\u00fcne g\u00fcvenmemek \u00f6nemlidir.<br \/>\n*   <strong>Yanl\u0131\u015f Y\u00f6nlendirme:<\/strong> Sald\u0131rganlar DNS kay\u0131tlar\u0131n\u0131 manip\u00fcle ederek veya sahte DNS sunucular\u0131 kullanarak uygulamalar\u0131n\u0131z\u0131 yanl\u0131\u015f bir IP adresine y\u00f6nlendirebilirler. Bu, hassas verilerin yanl\u0131\u015f sunuculara g\u00f6nderilmesine veya k\u00f6t\u00fc niyetli kodun indirilmesine yol a\u00e7abilir.<br \/>\n*   <strong>Uygulama D\u00fczeyinde Do\u011frulama:<\/strong> E\u011fer m\u00fcmk\u00fcnse, d\u00f6nen IP adresinin beklenen bir IP aral\u0131\u011f\u0131nda olup olmad\u0131\u011f\u0131n\u0131 veya belirli bir sunucuya ait olup olmad\u0131\u011f\u0131n\u0131 uygulama d\u00fczeyinde ek kontrollerle do\u011frulamak faydal\u0131 olabilir. \u00d6rne\u011fin, yaln\u0131zca belirli bir veri merkezi IP aral\u0131\u011f\u0131ndaki sunuculara ba\u011flanmaya izin vermek.<\/p>\n<h3>DDoS Sald\u0131r\u0131lar\u0131 ve Kaynak T\u00fckenmesi<\/h3>\n<p>*   <strong>S\u0131k DNS Sorgular\u0131:<\/strong> Uygulaman\u0131z\u0131n \u00e7ok s\u0131k ve gereksiz yere DNS sorgular\u0131 yapmas\u0131, hem kendi kaynaklar\u0131n\u0131z\u0131 (CPU, a\u011f) t\u00fcketebilir hem de DNS sunucular\u0131na gereksiz y\u00fck bindirerek DDoS (Distributed Denial of Service) sald\u0131r\u0131lar\u0131na benzer bir etki yaratabilir.<br \/>\n*   <strong>\u00d6nbellekleme Kullan\u0131m\u0131:<\/strong> Performans b\u00f6l\u00fcm\u00fcnde bahsedildi\u011fi gibi, <code>functools.lru_cache<\/code> gibi mekanizmalarla DNS sorgular\u0131n\u0131 \u00f6nbelle\u011fe almak, bu riski azaltman\u0131n en iyi yollar\u0131ndan biridir.<\/p>\n<h3>Sald\u0131rgan\u0131n Kontrol\u00fcndeki Hostname&#8217;ler<\/h3>\n<p>E\u011fer uygulaman\u0131z kullan\u0131c\u0131 taraf\u0131ndan sa\u011flanan bir hostname&#8217;i \u00e7\u00f6z\u00fcml\u00fcyorsa, bu hostname&#8217;in k\u00f6t\u00fc niyetli olabilece\u011fini varsaymal\u0131s\u0131n\u0131z.<br \/>\n*   <strong>G\u00fcvenlik A\u00e7\u0131klar\u0131:<\/strong> K\u00f6t\u00fc niyetli bir kullan\u0131c\u0131, \u00f6zel a\u011f\u0131n\u0131zdaki bir kayna\u011f\u0131n hostname&#8217;ini sa\u011flayarak i\u00e7 a\u011f\u0131n\u0131z hakk\u0131nda bilgi toplamaya \u00e7al\u0131\u015fabilir veya ba\u015fka bir g\u00fcvenlik a\u00e7\u0131\u011f\u0131n\u0131 tetikleyebilir.<br \/>\n*   <strong>Giri\u015f Do\u011frulamas\u0131:<\/strong> Kullan\u0131c\u0131dan al\u0131nan hostname&#8217;ler i\u00e7in sa\u011flam giri\u015f do\u011frulamas\u0131 ve sanitizasyon (temizleme) uygulamak \u00f6nemlidir. Ge\u00e7ersiz karakterleri filtrelemek veya belirli bir format\u0131 zorlamak bu t\u00fcr sald\u0131r\u0131lar\u0131 \u00f6nleyebilir.<\/p>\n<p>G\u00fcvenlik, a\u011f programlaman\u0131n ayr\u0131lmaz bir par\u00e7as\u0131d\u0131r. Python&#8217;\u0131n <code>socket<\/code> mod\u00fcl\u00fc g\u00fc\u00e7l\u00fc ara\u00e7lar sunsa da, bu ara\u00e7lar\u0131n nas\u0131l ve hangi ko\u015fullarda kullan\u0131ld\u0131\u011f\u0131, uygulaman\u0131z\u0131n genel g\u00fcvenlik duru\u015funu b\u00fcy\u00fck \u00f6l\u00e7\u00fcde etkiler. Her zaman en iyi g\u00fcvenlik uygulamalar\u0131n\u0131 takip etmek ve olas\u0131 riskleri minimize etmek i\u00e7in dikkatli olmak gereklidir.<\/p>\n<h2>Sonu\u00e7<\/h2>\n<p>Bu kapsaml\u0131 rehberde, Python&#8217;\u0131n <code>socket<\/code> mod\u00fcl\u00fcn\u00fc kullanarak bir hostname&#8217;den IP adresi \u00e7\u00f6z\u00fcmleme s\u00fcrecini detayl\u0131 bir \u015fekilde inceledik. DNS&#8217;in temel \u00e7al\u0131\u015fma prensiplerinden ba\u015flayarak, Python&#8217;da bu i\u015flemi ger\u00e7ekle\u015ftirmek i\u00e7in kullan\u0131lan ba\u015fl\u0131ca fonksiyonlar\u0131 (<code>socket.gethostbyname()<\/code>, <code>socket.gethostbyname_ex()<\/code>, <code>socket.getaddrinfo()<\/code>) ayr\u0131nt\u0131lar\u0131yla ele ald\u0131k.<\/p>\n<p>\u00d6zellikle <code>socket.getaddrinfo()<\/code> fonksiyonunun, hem IPv4 hem de IPv6 adreslerini desteklemesi, farkl\u0131 soket tipleri ve protokoller i\u00e7in esnek yap\u0131land\u0131rma se\u00e7enekleri sunmas\u0131 nedeniyle modern a\u011f uygulamalar\u0131 i\u00e7in en g\u00fc\u00e7l\u00fc ve \u00f6nerilen \u00e7\u00f6z\u00fcm oldu\u011funu vurgulad\u0131k. Hata y\u00f6netiminin \u00f6nemi ve <code>try-except<\/code> bloklar\u0131n\u0131n <code>socket.gaierror<\/code> gibi istisnalar\u0131 yakalamak i\u00e7in nas\u0131l kullan\u0131lmas\u0131 gerekti\u011fi \u00fczerinde durduk. Ayr\u0131ca, DNS \u00e7\u00f6z\u00fcmlemesinin performansa etkilerini azaltmak i\u00e7in i\u015fletim sistemi d\u00fczeyindeki \u00f6nbellekleme ve Python&#8217;da <code>functools.lru_cache<\/code> ile manuel \u00f6nbellekleme stratejilerini ele ald\u0131k.<\/p>\n<p>Pratik uygulama senaryolar\u0131 b\u00f6l\u00fcm\u00fcnde, bu yetene\u011fin a\u011f izleme, g\u00fcvenlik taramalar\u0131, web sunucusu yap\u0131land\u0131rmas\u0131, API entegrasyonlar\u0131 ve bulut ortamlar\u0131 gibi geni\u015f bir yelpazede nas\u0131l kullan\u0131labilece\u011fini g\u00f6sterdik. Son olarak, DNS sahtecili\u011fi, IP adresinin g\u00fcvenilirli\u011fi ve kaynak t\u00fckenmesi gibi \u00f6nemli g\u00fcvenlik konular\u0131na de\u011finerek, uygulamalar\u0131n\u0131z\u0131 geli\u015ftirirken dikkat etmeniz gereken riskleri ve korunma yollar\u0131n\u0131 belirttik.<\/p>\n<p>Python&#8217;\u0131n <code>socket<\/code> mod\u00fcl\u00fc, a\u011f programlaman\u0131n temelini olu\u015fturur ve hostname \u00e7\u00f6z\u00fcmleme yetene\u011fi, bir\u00e7ok a\u011f tabanl\u0131 uygulaman\u0131n kalbinde yer al\u0131r. Bu makalede sunulan bilgiler ve \u00f6rnekler sayesinde, okuyucular\u0131n Python projelerinde bu yetene\u011fi g\u00fcvenli, verimli ve sa\u011flam bir \u015fekilde kullanabilmeleri i\u00e7in gerekli bilgi birikimine sahip olmalar\u0131 hedeflenmi\u015ftir. Gelecekteki a\u011f altyap\u0131s\u0131 de\u011fi\u015fiklikleri ve g\u00fcvenlik tehditleri g\u00f6z \u00f6n\u00fcne al\u0131nd\u0131\u011f\u0131nda, <code>getaddrinfo()<\/code> gibi esnek ve kapsaml\u0131 fonksiyonlar\u0131 tercih etmek, uygulamalar\u0131n\u0131z\u0131n uzun \u00f6m\u00fcrl\u00fc ve dayan\u0131kl\u0131 olmas\u0131n\u0131 sa\u011flayacakt\u0131r.<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"Python ile Hostname&#8217;den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber\nGiri\u015f\n\u0130nternet d\u00fcnyas\u0131nda, kaynaklara eri\u015fim genellikle okunmas\u0131 ve ak\u0131","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_page_header_type":"","csco_page_load_nextpost":"","csco_page_subscribe_form":"","csco_page_contact_form":"","footnotes":""},"categories":[1403],"tags":[],"class_list":{"0":"post-40176","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-python","7":"cs-entry","8":"cs-video-wrap"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.5 (Yoast SEO v25.3.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python ile Hostname&#039;den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber - Kodlar\u0131n Gizemli D\u00fcnyas\u0131<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/\" \/>\n<meta property=\"og:locale\" content=\"tr_TR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python ile Hostname&#039;den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber\" \/>\n<meta property=\"og:description\" content=\"Python ile Hostname&#039;den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber  Giri\u015f \u0130nternet d\u00fcnyas\u0131nda, kaynaklara eri\u015fim genellikle okunmas\u0131 ve ak\u0131\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/\" \/>\n<meta property=\"og:site_name\" content=\"Kodlar\u0131n Gizemli D\u00fcnyas\u0131\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-24T22:40:58+00:00\" \/>\n<meta name=\"author\" content=\"Fatih Soysal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Yazan:\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fatih Soysal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tahmini okuma s\u00fcresi\" \/>\n\t<meta name=\"twitter:data2\" content=\"27 dakika\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/\"},\"author\":{\"name\":\"Fatih Soysal\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"headline\":\"Python ile Hostname&#8217;den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber\",\"datePublished\":\"2026-02-24T22:40:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/\"},\"wordCount\":4188,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"articleSection\":[\"Python\"],\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/#respond\"]}],\"copyrightYear\":\"2026\",\"copyrightHolder\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/\",\"name\":\"Python ile Hostname'den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber - Kodlar\u0131n Gizemli D\u00fcnyas\u0131\",\"isPartOf\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\"},\"datePublished\":\"2026-02-24T22:40:58+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/#breadcrumb\"},\"inLanguage\":\"tr\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Anasayfa\",\"item\":\"https:\/\/fatihsoysal.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python ile Hostname&#8217;den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#website\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/\",\"name\":\"Fatihsoysal.com\",\"description\":\"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim\",\"publisher\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"tr\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1\",\"name\":\"Fatih Soysal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"tr\",\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"contentUrl\":\"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png\",\"width\":512,\"height\":512,\"caption\":\"Fatih Soysal\"},\"logo\":{\"@id\":\"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/\"},\"description\":\"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.\",\"url\":\"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python ile Hostname'den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/","og_locale":"tr_TR","og_type":"article","og_title":"Python ile Hostname'den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber","og_description":"Python ile Hostname'den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber  Giri\u015f \u0130nternet d\u00fcnyas\u0131nda, kaynaklara eri\u015fim genellikle okunmas\u0131 ve ak\u0131","og_url":"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/","og_site_name":"Kodlar\u0131n Gizemli D\u00fcnyas\u0131","article_published_time":"2026-02-24T22:40:58+00:00","author":"Fatih Soysal","twitter_card":"summary_large_image","twitter_misc":{"Yazan:":"Fatih Soysal","Tahmini okuma s\u00fcresi":"27 dakika"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/#article","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/"},"author":{"name":"Fatih Soysal","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"headline":"Python ile Hostname&#8217;den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber","datePublished":"2026-02-24T22:40:58+00:00","mainEntityOfPage":{"@id":"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/"},"wordCount":4188,"commentCount":0,"publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"articleSection":["Python"],"inLanguage":"tr","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/#respond"]}],"copyrightYear":"2026","copyrightHolder":{"@id":"https:\/\/fatihsoysal.com\/blog\/#organization"}},{"@type":"WebPage","@id":"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/","url":"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/","name":"Python ile Hostname'den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber - Kodlar\u0131n Gizemli D\u00fcnyas\u0131","isPartOf":{"@id":"https:\/\/fatihsoysal.com\/blog\/#website"},"datePublished":"2026-02-24T22:40:58+00:00","breadcrumb":{"@id":"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/#breadcrumb"},"inLanguage":"tr","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/fatihsoysal.com\/blog\/python-ile-hostnameden-ip-adresi-cozumleme-kapsamli-bir-rehber\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Anasayfa","item":"https:\/\/fatihsoysal.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python ile Hostname&#8217;den IP Adresi \u00c7\u00f6z\u00fcmleme: Kapsaml\u0131 Bir Rehber"}]},{"@type":"WebSite","@id":"https:\/\/fatihsoysal.com\/blog\/#website","url":"https:\/\/fatihsoysal.com\/blog\/","name":"Fatihsoysal.com","description":"Blog - Yaz\u0131l\u0131m D\u00fcnyas\u0131 Tecr\u00fcbelerim","publisher":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fatihsoysal.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"tr"},{"@type":["Person","Organization"],"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/002a254750921dcfd568a99e48240dd1","name":"Fatih Soysal","image":{"@type":"ImageObject","inLanguage":"tr","@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","contentUrl":"https:\/\/fatihsoysal.com\/blog\/wp-content\/uploads\/2024\/04\/cropped-replicate-prediction-3kgg1hgjn5rgp0cf0p5tr0jw7w-1.png","width":512,"height":512,"caption":"Fatih Soysal"},"logo":{"@id":"https:\/\/fatihsoysal.com\/blog\/#\/schema\/person\/image\/"},"description":"Kullan\u0131m ve kodlama m\u00fckemmeliyetini odak alan uygulamalar olu\u015fturma deneyimine sahip, profesyonel olarak 15+ y\u0131l \u00fczeri deneyime sahip bir yaz\u0131l\u0131m m\u00fchendisi.","url":"https:\/\/fatihsoysal.com\/blog\/author\/fatihsoysal\/"}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/40176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/comments?post=40176"}],"version-history":[{"count":1,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/40176\/revisions"}],"predecessor-version":[{"id":40177,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/posts\/40176\/revisions\/40177"}],"wp:attachment":[{"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/media?parent=40176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/categories?post=40176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fatihsoysal.com\/blog\/wp-json\/wp\/v2\/tags?post=40176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}