I'm writing a perl script that has many threads doing this:

my %NetResource = (
  'Scope' => RESOURCE_CONNECTED,
  'Type' => RESOURCETYPE_ANY,
  'DisplayType' => RESOURCEDISPLAYTYPE_GENERIC,
  'Usage' => RESOURCEUSAGE_CONNECTABLE,
  'RemoteName' => "\\\\$hostname"
);

if (!Win32::NetResource::AddConnection(\%NetResource, "myuser", "mypass", 0)) {
  my($error) = "";
  Win32::NetResource::GetError($error);
  $error = Win32::FormatMessage($error);
  chomp $error;

  print "Error: $hostname\t$error\n";
} else {
  # do remote registry stuff
}

When I execute this script (which spawns many threads doing the above),
sometimes, if one thread gets a connect error, it will cause all the currently
running threads (doing the same AddConnection to die with the same error):

ie:

Error: machine1   The network path was not found.
Error: machine2   The network path was not found.
Error: machine3   The network path was not found.
Error: machine4   The network path was not found.
Error: machine5   The network path was not found.

And if you run it again, machines 2-5 are fine.. it's just machine1's thread
causing the others to fail.

Any ideas?

Thanks,

Phil
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to