<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>socat &#8211; CPYNET</title>
	<atom:link href="https://cpynet.com.tr/tag/socat/feed/" rel="self" type="application/rss+xml" />
	<link>https://cpynet.com.tr</link>
	<description>Yeni Nesil Teknoloji Platformu</description>
	<lastBuildDate>Mon, 18 Nov 2024 11:27:17 +0000</lastBuildDate>
	<language>tr</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://cpynet.com.tr/wp-content/uploads/2024/11/cropped-favicon-32x32.png</url>
	<title>socat &#8211; CPYNET</title>
	<link>https://cpynet.com.tr</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Socat ile TCP ve UDP Bağlantılarını Yönetin</title>
		<link>https://cpynet.com.tr/socat-ile-tcp-ve-udp-baglantilarini-yonetin/</link>
		
		<dc:creator><![CDATA[Emin Buyuk]]></dc:creator>
		<pubDate>Wed, 30 Oct 2024 16:00:01 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sistem yönetimi]]></category>
		<category><![CDATA[socat]]></category>
		<guid isPermaLink="false">https://cpynet-wordpress.wekeea.easypanel.host/socat-ile-tcp-ve-udp-baglantilarini-yonetin/</guid>

					<description><![CDATA[Linux dünyasında, çeşitli veri kaynaklarını birbirine bağlamak için kullanılan birçok araç bulunur. Bu yazıda, esnek ve çok amaçlı&#8230;]]></description>
										<content:encoded><![CDATA[
<p>Linux dünyasında, çeşitli veri kaynaklarını birbirine bağlamak için kullanılan birçok araç bulunur. Bu yazıda, esnek ve çok amaçlı bir araç olan <strong>socat</strong> komutunu inceleyeceğiz. Socat, iki veri kaynağı arasında bağlantı kurarak veri aktarımı sağlayan güçlü bir araçtır. Bu veri kaynakları dosyalar, Unix socket’ler, TCP/UDP protokolleri veya standart input olabilir.</p>



<h2 class="wp-block-heading" id="socat-nedir-ve-ne-i%CC%87%C5%9Fe-yarar">Socat Nedir ve Ne İşe Yarar?</h2>



<p>Socat’ın temel amacı, iki veri kaynağı arasında bir köprü oluşturmaktır. Örneğin, bir uygulamayı başka bir sunucuya bağlamak veya veri akışını iki farklı kaynağa yönlendirmek gibi çok çeşitli kullanım alanları vardır. Örneğin, güvenlik nedeniyle dış erişime kapalı bir sunucunuz var ve sadece log dosyalarını başka bir sunucuda görüntülemek istiyorsunuz. Socat, bu senaryoda devreye girerek iki sunucu arasında güvenli bir veri aktarımı sağlar.</p>



<h2 class="wp-block-heading" id="socat-kurulumu">Socat Kurulumu</h2>



<p>Linux sisteminizde socat&#8217;ı kullanabilmek için öncelikle kurulum yapmanız gerekir. Çoğu Linux dağıtımında socat, paket yöneticileri üzerinden kolayca yüklenebilir.</p>



<h3 class="wp-block-heading" id="debian-tabanl%C4%B1-da%C4%9F%C4%B1t%C4%B1mlarda-socat-kurulumu">Debian Tabanlı Dağıtımlarda Socat Kurulumu</h3>



<p>Debian, Ubuntu gibi dağıtımlarda socat’ı şu komutla kurabilirsiniz:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="sudo apt-get install socat
" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #50FA7B">sudo</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">apt-get</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">install</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">socat</span></span>
<span class="line"></span></code></pre></div>



<h3 class="wp-block-heading" id="rhel-tabanl%C4%B1-da%C4%9F%C4%B1t%C4%B1mlarda-socat-kurulumu">RHEL Tabanlı Dağıtımlarda Socat Kurulumu</h3>



<p>Fedora gibi RHEL tabanlı sistemlerde ise aşağıdaki komutu kullanarak socat’ı yükleyebilirsiniz:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="sudo yum install socat
" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #50FA7B">sudo</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">yum</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">install</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">socat</span></span>
<span class="line"></span></code></pre></div>



<h2 class="wp-block-heading" id="socat-kullan%C4%B1m-%C3%B6rnekleri">Socat Kullanım Örnekleri</h2>



<p>Socat’ın nasıl çalıştığını daha iyi anlamak için birkaç örnek üzerinden ilerleyelim.</p>



<h3 class="wp-block-heading" id="1-i%CC%87ki-veri-kayna%C4%9F%C4%B1n%C4%B1-ba%C4%9Flamak">1. İki Veri Kaynağını Bağlamak</h3>



<p>Socat, iki veri kaynağını birbirine bağlamak için kullanılabilir. Örneğin, <strong>netcat</strong> (nc) ile TCP protokolü kullanarak iki terminal arasında veri alışverişi yapalım.</p>



<h4 class="wp-block-heading" id="ad%C4%B1m-1-dinleyici-modunda-netcat-%C3%A7al%C4%B1%C5%9Ft%C4%B1r%C4%B1n">Adım 1: Dinleyici Modunda Netcat Çalıştırın</h4>



<p>İlk terminalde, localhost üzerinde bir port açarak <strong>nc</strong> komutunu dinleyici modunda çalıştırın:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="nc -l localhost 1234
" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #50FA7B">nc</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">-l</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">localhost</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">1234</span></span>
<span class="line"></span></code></pre></div>



<p>Bu komut, localhost üzerinde 1234 portunu dinlemeye alır.</p>



<h4 class="wp-block-heading" id="ad%C4%B1m-2-socat-ile-ba%C4%9Flant%C4%B1-kurun">Adım 2: Socat ile Bağlantı Kurun</h4>



<p>İkinci terminalde, <strong>socat</strong> komutunu kullanarak standart input (STDIO) ile bu porta bağlanın:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="socat STDIO TCP4:localhost:1234
" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #50FA7B">socat</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">STDIO</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">TCP4:localhost:1234</span></span>
<span class="line"></span></code></pre></div>



<p>Artık iki terminal arasında veri alışverişi yapabilirsiniz. İlk terminalde yazdığınız herhangi bir mesaj, ikinci terminalde görünecek ve tersi de geçerli olacaktır.</p>



<h3 class="wp-block-heading" id="2-veri-y%C3%B6nlendirme">2. Veri Yönlendirme</h3>



<p>Socat, aynı zamanda veri akışını yönlendirebilir. Örneğin, bir sunucudaki veriyi başka bir sunucuya iletmek için kullanılabilir. İki terminal yerine bu sefer üç terminal kullanarak bir veri yönlendirme örneği yapalım.</p>



<h4 class="wp-block-heading" id="ad%C4%B1m-1-i%CC%87lk-terminalde-netcat-%C3%A7al%C4%B1%C5%9Ft%C4%B1r%C4%B1n">Adım 1: İlk Terminalde Netcat Çalıştırın</h4>



<p>İlk terminalde yine netcat’i dinleyici modunda çalıştırın:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="nc -l localhost 1234
" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #50FA7B">nc</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">-l</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">localhost</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">1234</span></span>
<span class="line"></span></code></pre></div>



<h4 class="wp-block-heading" id="ad%C4%B1m-2-i%CC%87kinci-terminalde-socat-ile-y%C3%B6nlendirme-yap%C4%B1n">Adım 2: İkinci Terminalde Socat ile Yönlendirme Yapın</h4>



<p>İkinci terminalde, 4321 portunu dinleyip bu veriyi ilk terminaldeki 1234 portuna yönlendiren bir socat komutu çalıştırın:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="socat TCP4-LISTEN:4321 TCP4:localhost:1234
" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #50FA7B">socat</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">TCP4-LISTEN:4321</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">TCP4:localhost:1234</span></span>
<span class="line"></span></code></pre></div>



<h4 class="wp-block-heading" id="ad%C4%B1m-3-%C3%BC%C3%A7%C3%BCnc%C3%BC-terminal-ile-ba%C4%9Flant%C4%B1-kurun">Adım 3: Üçüncü Terminal ile Bağlantı Kurun</h4>



<p>Üçüncü terminalde ise, yeni oluşturduğunuz 4321 portuna bağlanın:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="socat STDIO TCP4:localhost:4321
" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #50FA7B">socat</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">STDIO</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">TCP4:localhost:4321</span></span>
<span class="line"></span></code></pre></div>



<p>Artık üçüncü terminalde yazdığınız her şey, önce ikinci terminaldeki socat aracılığıyla yönlendirilip, ilk terminaldeki netcat’e iletilecek.</p>



<h3 class="wp-block-heading" id="3-docker-ile-socat-kullan%C4%B1m%C4%B1">3. Docker ile Socat Kullanımı</h3>



<p>Daha pratik bir örnek olarak, Docker içinde çalışan bir <strong>Nginx</strong> sunucusunu, <strong>socat</strong> kullanarak bir terminal üzerinden kontrol edelim.</p>



<h4 class="wp-block-heading" id="ad%C4%B1m-1-nginx-docker-i%CC%87maj%C4%B1n%C4%B1-%C3%A7ekin-ve-%C3%A7al%C4%B1%C5%9Ft%C4%B1r%C4%B1n">Adım 1: Nginx Docker İmajını Çekin ve Çalıştırın</h4>



<p>İlk olarak, Nginx Docker imajını çekin ve çalıştırın:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="docker pull nginx
docker run -p 80:80 nginx
" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #50FA7B">docker</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">pull</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">nginx</span></span>
<span class="line"><span style="color: #50FA7B">docker</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">run</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">-p</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">80</span><span style="color: #F1FA8C">:80</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">nginx</span></span>
<span class="line"></span></code></pre></div>



<h4 class="wp-block-heading" id="ad%C4%B1m-2-socat-ile-ba%C4%9Flant%C4%B1-kurun-1">Adım 2: Socat ile Bağlantı Kurun</h4>



<p>Ardından, socat kullanarak Nginx sunucusuna bir TCP bağlantısı kurun:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="socat TCP-LISTEN:1234,reuseaddr,fork TCP:localhost:80
" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #50FA7B">socat</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">TCP-LISTEN:1234,reuseaddr,fork</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">TCP:localhost:80</span></span>
<span class="line"></span></code></pre></div>



<p>Bu komut, 1234 portunu dinleyip, localhost üzerindeki 80 portuna gelen istekleri yönlendirecektir.</p>



<h4 class="wp-block-heading" id="ad%C4%B1m-3-ba%C4%9Flant%C4%B1y%C4%B1-test-edin">Adım 3: Bağlantıyı Test Edin</h4>



<p>Başka bir terminalde, aşağıdaki komutla bağlantı kurarak bir GET isteği gönderin:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="socat STDIO TCP4:localhost:1234
" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #50FA7B">socat</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">STDIO</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">TCP4:localhost:1234</span></span>
<span class="line"></span></code></pre></div>



<p>GET isteğini gönderdiğinizde, Nginx sunucusundan gelen yanıtı terminalde görebileceksiniz.</p>



<h2 class="wp-block-heading" id="tek-y%C3%B6nl%C3%BC-veri-aktar%C4%B1m%C4%B1">Tek Yönlü Veri Aktarımı</h2>



<p>Socat varsayılan olarak çift yönlü veri akışını destekler, ancak belirli durumlarda sadece tek yönlü veri akışı sağlamak isteyebilirsiniz. Bunu sağlamak için <strong>-u</strong> bayrağını kullanabilirsiniz.</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282A36"><svg xmlns="http://www.w3.org/2000/svg" width="54" height="14" viewBox="0 0 54 14"><g fill="none" fill-rule="evenodd" transform="translate(1 1)"><circle cx="6" cy="6" r="6" fill="#FF5F56" stroke="#E0443E" stroke-width=".5"></circle><circle cx="26" cy="6" r="6" fill="#FFBD2E" stroke="#DEA123" stroke-width=".5"></circle><circle cx="46" cy="6" r="6" fill="#27C93F" stroke="#1AAB29" stroke-width=".5"></circle></g></svg></span><span role="button" tabindex="0" data-code="socat -u STDIO FILE:test.txt,create
" style="color:#F8F8F2;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dracula" style="background-color: #282A36" tabindex="0"><code><span class="line"><span style="color: #50FA7B">socat</span><span style="color: #F8F8F2"> </span><span style="color: #BD93F9">-u</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">STDIO</span><span style="color: #F8F8F2"> </span><span style="color: #F1FA8C">FILE:test.txt,create</span></span>
<span class="line"></span></code></pre></div>



<p>Bu komut, standard input&#8217;tan aldığınız veriyi bir dosyaya yazacaktır.</p>



<h2 class="wp-block-heading" id="sonu%C3%A7">Sonuç</h2>



<p>Bu makalede, Linux sistemlerinde yaygın olarak kullanılan <strong>socat</strong> komutunun temel kullanımını ve birkaç pratik örneğini inceledik. Socat, çift yönlü ve tek yönlü veri akışını sağlayabilen çok yönlü bir araçtır. Özellikle sunucu yönetimi, ağ bağlantıları ve veri yönlendirme senaryolarında işinizi büyük ölçüde kolaylaştırabilir.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
