summaryrefslogtreecommitdiff
path: root/pysnmp/carrier/asynsock
diff options
context:
space:
mode:
Diffstat (limited to 'pysnmp/carrier/asynsock')
-rw-r--r--pysnmp/carrier/asynsock/dgram/unix.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/pysnmp/carrier/asynsock/dgram/unix.py b/pysnmp/carrier/asynsock/dgram/unix.py
index 167f01e..267f87d 100644
--- a/pysnmp/carrier/asynsock/dgram/unix.py
+++ b/pysnmp/carrier/asynsock/dgram/unix.py
@@ -1,5 +1,5 @@
# Implements asyncore-based UNIX transport domain
-from os import remove
+from os import remove, tmpnam
from socket import AF_UNIX
from pysnmp.carrier.asynsock.dgram.base import DgramSocketTransport
@@ -8,6 +8,13 @@ domainName = snmpLocalDomain = (1, 3, 6, 1, 2, 1, 100, 1, 13)
class UnixSocketTransport(DgramSocketTransport):
sockFamily = AF_UNIX
+ def openClientMode(self, iface=None):
+ if iface is None:
+ iface = tmpnam() # UNIX domain sockets must be explicitly bound
+ DgramSocketTransport.openClientMode(self, iface)
+ self.__iface = iface
+ return self
+
def openServerMode(self, iface):
DgramSocketTransport.openServerMode(self, iface)
self.__iface = iface