Skip to content

Commit

Permalink
Add tcp rst function
Browse files Browse the repository at this point in the history
  • Loading branch information
rickwu666666 committed Dec 12, 2023
1 parent d5ac400 commit 7f531d9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions checkbox-provider-ce-oem/bin/tcp_multi_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import threading
import logging
import time
import struct
from datetime import datetime, timedelta

logging.basicConfig(
Expand Down Expand Up @@ -146,6 +147,16 @@ def send_payload(host, port, payload, start_time):
results.append("{}:ERROR".format(port))


def send_rst(host, port):
server_host = (host, port)
l_onoff = 1
l_linger = 0
with socket.create_connection(server_host) as client_socket:
client_socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
struct.pack('ii', l_onoff, l_linger))
client_socket.close()


if __name__ == "__main__":
"""
TCP Ping Test
Expand Down

0 comments on commit 7f531d9

Please sign in to comment.