fake_trx/udp_link.py: set SO_REUSEADDR socket option
Setting this option allows one to reuse existing connections, for example, by injecting CTRL commands or DATA bursts into existing connections between fake_trx.py and trxcon. Change-Id: I0882c76affa9a668a12d10967081054d2b666ed1
This commit is contained in:
parent
23446011af
commit
24e30142aa
|
@ -27,6 +27,7 @@ import socket
|
||||||
class UDPLink:
|
class UDPLink:
|
||||||
def __init__(self, remote_addr, remote_port, bind_port):
|
def __init__(self, remote_addr, remote_port, bind_port):
|
||||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
|
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
self.sock.bind(('0.0.0.0', bind_port))
|
self.sock.bind(('0.0.0.0', bind_port))
|
||||||
self.sock.setblocking(0)
|
self.sock.setblocking(0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue