Closed keisetsu closed 9 years ago
My example above is pretty trivial. The real problem is that I can't do this: connection.connect(IP_ADDRESS) connection.close() connection.connect(IP_ADDRESS)
I get a "Connection reset by peer" socket.error in 3.2 in both this and the above cases.
Is this by design?
@keisetsu : It was not designed deliberately this way. It's just that we don't have an use case when we need to reuse the same connection instance again, so the connection state is not "reset" properly when the connection is closed.
This appears to be working as I wanted in 1.1.16, if not earlier. Sorry it took so long to report this; I haven't been fiddling with SMB code for a while.
Thanks again for your work!
Using Python 3.3.4, pysmb 1.1.12:
from smb.SMBConnection import SMBConnection
connection = SMBConnection(USERNAME, PASSWORD, CLIENTNAME, SERVERNAME, DOMAIN) connection.connect(IP_ADDRESS) connection.connect(IP_ADDRESS)
causes an UnboundLocalError:
SMBConnection.py", line 505, in _pollForNetBIOSPacket if type(ex) is tuple: UnboundLocalError: local variable 'type' referenced before assignment
In 3.2 the socket.error passes through. I believe this is because of changes to exceptions in socket.error in python 3.3 and newer. It looks to me that this breaks backwards compatibility, so it might be something to report to the python developers. https://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy
I think I can work around this for now, but I thought you should know. I will try to take a look at it if I get the time.