print 'Could not dial the RAS connection:', win32ras.GetErrorString(rc)
hras = HangUp(hras)
elif bUseCallback and win32event.WaitForSingleObject(callbackEvent, 60000) != win32event.WAIT_OBJECT_0:
print 'Gave up waiting for the process to complete!'
try:
cs = win32ras.GetConnectStatus(hras)
except:
hras = HangUp(hras)
if int(cs[0]) == win32ras.RASCS_Disconnected:
hras = HangUp(hras)
return (hras, rc)
def Disconnect(rasEntry):
name = string.lower(rasEntry)
for hcon, entryName, devName, devType in win32ras.EnumConnections():
if string.lower(entryName) == name:
win32ras.HangUp(hcon)
print 'Disconnected from', rasEntry
break
continue
else:
print 'Could not find an open connection to', entryName
usage = '\nUsage: %s [-s] [-l] [-c connection] [-d connection]\n-l : List phone-book entries and current connections.\n-s : Show status while connecting/disconnecting (uses callbacks)\n-c : Connect to the specified phonebook name.\n-d : Disconnect from the specified phonebook name.\n-e : Edit the specified phonebook entry.\n'