How to reset TCP connection on Linux?

Jon Ribbens jon+usenet at
Mon Dec 3 12:53:43 EST 2018

On 2018-12-03, Grant Edwards <grant.b.edwards at> wrote:
> How does one reset a TCP connection on Linux?  Note that I want to
> reset the connection, not close it.

Something like the following should work I believe, although I have
not tested it:

        struct.pack('ii', 1, 0)

Possibly you might want a sock.shutdown(socket.SHUT_RDWR) before
the close().

More information about the Python-list mailing list