title: python3.8 http.server - ConnectionResetError: [Errno 104] Connection reset by peer
body: <p>I've set up a simple http server to share some files with a friend. I know there are other ways of sharing files, but I'm interested in doing it this way and solving the issues raised.</p>
  <p>The server side code is simple :</p>
  <pre><code> #!/bin/bash
   /usr/bin/python3 -u -m http.server -d /srv/carmine 2339
  </code></pre>
  <p>where <code>carmine</code> is a directory containing files.</p>
  <p>I can access files through <code>localhost:2339</code> and my friend can download files and reports no error on their side, but my logs show this:</p>
  <pre><code>   Exception happened during processing of request from ('xxxxxxxxx', 55664)
     Traceback (most recent call last):
       File &quot;/usr/lib/python3.8/socketserver.py&quot;, line 650, in process_request_thread
         self.finish_request(request, client_address)
       File &quot;/usr/lib/python3.8/socketserver.py&quot;, line 360, in finish_request
         self.RequestHandlerClass(request, client_address, self)
       File &quot;/usr/lib/python3.8/http/server.py&quot;, line 647, in __init__
         super().__init__(*args, **kwargs)
       File &quot;/usr/lib/python3.8/socketserver.py&quot;, line 720, in __init__
         self.handle()
       File &quot;/usr/lib/python3.8/http/server.py&quot;, line 427, in handle
         self.handle_one_request()
       File &quot;/usr/lib/python3.8/http/server.py&quot;, line 415, in handle_one_request
         method()
       File &quot;/usr/lib/python3.8/http/server.py&quot;, line 654, in do_GET
         self.copyfile(f, self.wfile)
       File &quot;/usr/lib/python3.8/http/server.py&quot;, line 853, in copyfile
         shutil.copyfileobj(source, outputfile)
       File &quot;/usr/lib/python3.8/shutil.py&quot;, line 205, in copyfileobj
         fdst_write(buf)
       File &quot;/usr/lib/python3.8/socketserver.py&quot;, line 799, in write
         self._sock.sendall(b)
     ConnectionResetError: [Errno 104] Connection reset by peer
     
  </code></pre>
  <p>What is happening here? Do I need to set some server side parameters?</p>