-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Scenarios:
Sometimes, enduser need to run longterm traffic (more than 2 hours), and ixia client socket will idle after send out traffic, some network gateway or linux server maybe close ixia client socket due to no any response during that time, then script will crash due to socket closed.
Solution:
Use "setsockopt" to set socket as keepalived, detail pls refer Python socket.TCP_KEEPINTVL() Examples
Code change as below:
def connect(self):
log.debug('Opening connection to %s:%d', self.host, self.port)
fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
fd.connect((self.host, self.port))
self.fd = fd
self.set_socket_keepalive
self.call('package req IxTclHal')
def set_socket_keepalive(self):
self.fd.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
self.fd.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 1)
self.fd.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 60)
self.fd.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 5)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels