title: Recover a TCP connection
body: <p>I have a simple Python server which can handle multiple clients:</p>
  
  <pre><code>import select 
  import socket 
  import sys 
  
  host = '' 
  port = 50000 
  backlog = 5 
  size = 1024 
  server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
  server.bind((host,port)) 
  server.listen(backlog) 
  input = [server,sys.stdin] 
  running = 1 
  while running: 
      inputready,outputready,exceptready = select.select(input,[],[]) 
  
      for s in inputready: 
  
          if s == server: 
              # handle the server socket 
              client, address = server.accept() 
              input.append(client) 
  
          elif s == sys.stdin: 
              # handle standard input 
              junk = sys.stdin.readline() 
              running = 0 
  
          else: 
              # handle all other sockets 
              data = s.recv(size) 
              if data: 
                  s.send(data) 
              else: 
                  s.close() 
                  input.remove(s) 
  server.close()
  </code></pre>
  
  <p>One client connects to it and they can communicate. I have a third box from where I am sending a <code>RST</code> signal to the server (using Scapy). The TCP state diagram does not say if an endpoint is supposed to try to recover a connection when it sees a RESET. Is there any way I can force the server to recover the connection? (I want it to send back a <code>SYN</code> so that it gets connected to the third client)</p>