<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="https://build2be.com"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>build2be/com/e - netcat</title>
 <link>https://build2be.com/category/netcat</link>
 <description></description>
 <language>en</language>
<item>
 <title>Simple echo server</title>
 <link>https://build2be.com/content/simple-echo-server</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot;&gt;&lt;pre&gt;&lt;code class=&quot;python&quot;&gt;#!/usr/bin/env python
# FILE: server.py

import socket

HOST = &#039;&#039;
PORT = 3000
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.bind((HOST, PORT))
    s.listen(1)
    conn, addr = s.accept()
    with conn:
        print(&#039;Connected by&#039;, addr)
        while True:
            data = conn.recv(1024)
            if data == b&#039;\n&#039;:
                break
            conn.sendall(data)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;then&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;python server.py
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;netcat localhost 3000
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;to test against&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 08 Feb 2021 15:57:50 +0000</pubDate>
 <dc:creator>clemens</dc:creator>
 <guid isPermaLink="false">215 at https://build2be.com</guid>
 <comments>https://build2be.com/content/simple-echo-server#comments</comments>
</item>
</channel>
</rss>
