title: "The connection was reset" on web browsers when trying to connect to a localhost socket server
body: <p>I am trying to make a server in python using sockets that I can connect to on any web browser.  I am using the host as "localhost" and the port as 8888.  </p>
  
  <p>When I attempt to connect to it, the stuff I want to be shown shows up for a split-second, and then it goes away with the browser saying "The connection was reset".<br>
  I've made it do something very simple to test if it still does it, and it does.</p>
  
  <p>Is there a way to stop this?    </p>
  
  <pre><code>import time
  import socket
  HOST = "localhost"
  PORT = 8888
  
  def function(sck):
      sck.send(bytes("test"),"UTF-8"))
      sck.close()
  
  ssck=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
  ssck.bind((HOST,PORT))
  ssck.listen(1)
  while True:
      sck,addr=ssck.accept()
      function(sck)
  </code></pre>