aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-08-09 19:20:52 +0700
committerPiotr Krysik <ptrkrysik@gmail.com>2018-09-13 15:35:44 +0200
commit8705f0e5466131260bac11bb61095b586db65f1a (patch)
tree46943a6bfca1aa611ab334a5f5ec8c8111f4c5f4 /python
parented9d7282d49812d356f28fc8a9756fc752ae7702 (diff)
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. Cherry-picked from: I0882c76affa9a668a12d10967081054d2b666ed1 Change-Id: I6d256683a7aa0419cd5bd0a3eaa97aefdf3254f9
Diffstat (limited to 'python')
-rw-r--r--python/trx/udp_link.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/python/trx/udp_link.py b/python/trx/udp_link.py
index cedcb1b..1fae8b4 100644
--- a/python/trx/udp_link.py
+++ b/python/trx/udp_link.py
@@ -28,6 +28,7 @@ import select
class udp_link:
def __init__(self, remote_addr, remote_port, bind_port):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.sock.bind((remote_addr, bind_port))
self.sock.setblocking(0)