diff options
author | elie <elie> | 2012-06-30 10:08:03 +0000 |
---|---|---|
committer | elie <elie> | 2012-06-30 10:08:03 +0000 |
commit | 53fa754af90aa91eaf127f44a35a3d522cb6dca6 (patch) | |
tree | 00f7eb7c6521a7837345b95832cdb4786c6e2dbf /pysnmp/carrier/asynsock | |
parent | c731b1a82e981a5f87f7434692fd38c7f056c0c0 (diff) | |
download | pysnmp-53fa754af90aa91eaf127f44a35a3d522cb6dca6.tar.gz |
UNIX domain sockets must be explicitly bound regardless of client/server role
Diffstat (limited to 'pysnmp/carrier/asynsock')
-rw-r--r-- | pysnmp/carrier/asynsock/dgram/unix.py | 9 |
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 |