program or script to close or reset a TCP connection
by Skaperen from LinuxQuestions.org on (#5PWG4)
a process on my local Xubuntu 18.04.5 has a TCP connection open. when the connection closes it will update some data and exit. this connection could stay up for hours. i want to end this. i do want the data to be updated which means i must not kill the process. the only way i can see to do this is to reset the connection. i hope this is enough to get the program to finish and exit. i know that TCP has special packet types FIN and RST to close a connection. i do not want to manually construct packets to do this. i want a program or script that can do it. i can provide the address and port on both ends. if the program needs to extract data out of the connection it will be run as root so it will have access to that. i prefer something with source in C or Python but any source is OK. i just don't want to kill the program that has the connection open. any suggested programs or scripts? i don't want to write this myself.