def send_testcase(json, ip, port):
"""
Send a raw testcase
"""
try:
json = struct.pack("<I", len(json)) + json
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip, int(port)))
s.send(json)
s.shutdown(socket.SHUT_RDWR)
s.close()
return True
except socket.error:
return False
except socket.error as e:
raise PJFSocketError(e.message if hasattr(e, "message") else str(e))
except Exception as e:
raise PJFBaseException(e.message)
评论列表
文章目录