win32wnet.WNetAddConnection2 to specific network interface?
half.italian at gmail.com
Wed Apr 14 18:18:11 EDT 2010
I have a small app that uses pywin32 to log on to a remote host and
send some files around. It works well, but I've found a machine that
the app won't work on.
The machine is dual-homed, with one interface able to see the server
machine, but the other can not. I don't have the exact error because
I can't currently get on to the machine where the app fails, but I am
told it is something like that "that server doesn't exist".
Could it be that it is trying to use the wrong interface? ie. The
interface on the wrong vlan? If so, is there a way to force the
connection to go to a specific interface? I'll post the exact error
after I can get on that machine. Thanks!
I'm using this wnet_connect() function that I found somewhere. It
works perfectly except on this one machine.
def wnet_connect(self, host, username, password):
unc = ''.join(['\\\\', host])
None, username, password)
except Exception, err:
if isinstance(err, win32wnet.error):
if err == 1219:
win32wnet.WNetCancelConnection2(unc, 0, 0)
return wnet_connect(host, username, password)
More information about the Python-list