🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
6 messages
6 total messages Started by Bob Reeves Sun, 15 Jul 2007 16:57
Weird problem with WNetAddConnection2()
#1565
Author: Bob Reeves
Date: Sun, 15 Jul 2007 16:57
41 lines
2927 bytes
Not sure if anyone can help but I have ran into a weird problem with
WNetAddConnection2(), one of those "it should work but it doesn't"
problems... First off, the code is working fine in 14 locations with the
same computer/network setup. I would post the actual code but don't think it
would help because it is working in more places than it isn't.

A little background...

3 computers tied together, two running Windows 2000 one running NT 4.0,
simple LAN using NetBEUI. The two windows 2000 computers connect to a drive
on the NT computer via WNetAddConnection2() (logging in as Guest) in the
application(s) software. The code is identical in both applications. The
Guest account on the NT machine has Admin status...

In one location one of the Windows 2000 computers refuses to connect,
WNetAddConnection2() fails. Lets just call the two Win2000 computers Comp1
and Comp2 for the following...

Comp1 connects to the NT computer fine.
Comp2 refuses to connect even if Comp1 isn't on.
Replace Comp2 with another Computer and it works.
Take Comp2 to a different site and it works.
Can access the NT computers drive from Comp2 through My Network.
Can access Comp2 from the NT computer through Network Neighborhood.

It seem like that particular windows 2000 computer doesn't like that
particular NT computer because through all the switching and swapping
everything works except when these two computers are tied together.

Please understand this isn't a simple network problem we have spent two
solid days on the phone chasing down all the normal stuff plus the guy on
the other end has made many trips to another site swapping computers. Also a
permanent computer swap isn't possible for reasons outside my control. I
have an exact copy of the system here in my office and it works great, if I
could make this one fail I would know what is wrong with the other.

Any Ideas ? If I can't come up with a solution before next Tuesday I will
have to make a 900 mile round trip to try and fix it.

-- 
Bob
Re: Weird problem with WNetAddConnection2()
#1566
Author: Dennis Jones
Date: Mon, 16 Jul 2007 02:30
19 lines
1874 bytes
"Bob Reeves" <bob@somethinxtra.com> wrote in message 
news:469a536d@newsgroups.borland.com...
> Not sure if anyone can help but I have ran into a weird problem with
> WNetAddConnection2(), one of those "it should work but it doesn't"
> problems... First off, the code is working fine in 14 locations with the
> same computer/network setup. I would post the actual code but don't think 
> it
> would help because it is working in more places than it isn't.

This might be a silly question, but since you don't say *how* it fails, are 
you checking the result of GetLastError when the function fails?  Surely 
that would lead you in the right direction.

Is there any chance the problematic machine is trying to use the same IP 
address as (and therefore conflicting with) another machine on the network 
(perhaps via a secondary IP address that is assigned to the network card)?

- Dennis 
Re: Weird problem with WNetAddConnection2()
#1570
Author: Colin B Maharaj
Date: Mon, 16 Jul 2007 12:08
47 lines
3462 bytes
1. Check you network cable - maybe all the pins are not terminated.
2. Check firewall settings. Disable firewall momentarily and check.
3. Not sure if this makes a difference but ensure you do not have blank 
passwords on the machines.
4. And do the GetLastError if all fails.


Bob Reeves wrote:
> Not sure if anyone can help but I have ran into a weird problem with
> WNetAddConnection2(), one of those "it should work but it doesn't"
> problems... First off, the code is working fine in 14 locations with the
> same computer/network setup. I would post the actual code but don't think it
> would help because it is working in more places than it isn't.
> 
> A little background...
> 
> 3 computers tied together, two running Windows 2000 one running NT 4.0,
> simple LAN using NetBEUI. The two windows 2000 computers connect to a drive
> on the NT computer via WNetAddConnection2() (logging in as Guest) in the
> application(s) software. The code is identical in both applications. The
> Guest account on the NT machine has Admin status...
> 
> In one location one of the Windows 2000 computers refuses to connect,
> WNetAddConnection2() fails. Lets just call the two Win2000 computers Comp1
> and Comp2 for the following...
> 
> Comp1 connects to the NT computer fine.
> Comp2 refuses to connect even if Comp1 isn't on.
> Replace Comp2 with another Computer and it works.
> Take Comp2 to a different site and it works.
> Can access the NT computers drive from Comp2 through My Network.
> Can access Comp2 from the NT computer through Network Neighborhood.
> 
> It seem like that particular windows 2000 computer doesn't like that
> particular NT computer because through all the switching and swapping
> everything works except when these two computers are tied together.
> 
> Please understand this isn't a simple network problem we have spent two
> solid days on the phone chasing down all the normal stuff plus the guy on
> the other end has made many trips to another site swapping computers. Also a
> permanent computer swap isn't possible for reasons outside my control. I
> have an exact copy of the system here in my office and it works great, if I
> could make this one fail I would know what is wrong with the other.
> 
> Any Ideas ? If I can't come up with a solution before next Tuesday I will
> have to make a 900 mile round trip to try and fix it.
> 
Re: Weird problem with WNetAddConnection2()
#1571
Author: Bob Reeves
Date: Mon, 16 Jul 2007 16:08
15 lines
1862 bytes
Thanks for responding..

All the network components and configuration settings were checked, double
checked and most replaced at some point during the troubleshooting process.
The software doesn't call GetLastError, it just checks for a non 0 return. I
know it should have been in the code in the first place but this code has
worked fine in many installations over 7 years. What few problems we have
had were always traced to an easily found network problem.

We just finished building a replacement for the NT machine and am hoping the
customer will just let me ship him the replacement. The problem has to be in
the NT computer as everything else has been swapped out during the testing.
When I get his machine back I will see if I can duplicate the problem here.

If I ever find what it is I will post the results..
Re: Weird problem with WNetAddConnection2()
#1572
Author: Dennis Jones
Date: Mon, 16 Jul 2007 16:57
38 lines
2573 bytes
"Bob Reeves" <bob@somethinxtra.com> wrote in message 
news:469b97ec$1@newsgroups.borland.com...
> Thanks for responding..
>
> All the network components and configuration settings were checked, double
> checked and most replaced at some point during the troubleshooting 
> process.
> The software doesn't call GetLastError, it just checks for a non 0 return. 
> I
> know it should have been in the code in the first place but this code has
> worked fine in many installations over 7 years. What few problems we have
> had were always traced to an easily found network problem.
>
> We just finished building a replacement for the NT machine and am hoping 
> the
> customer will just let me ship him the replacement.

And if not?

I can't help but wonder how many of the "traced to an easily found network 
problem" could have been solved even more quickly with a well-placed 
GetLastError.  And just because you've never found it useful before, doesn't 
mean that GetLastError wouldn't be useful now.  Surely by now you understand 
that there are many hundreds and thousands of ways software can fail, and 
that no one problem-solving technique can resolve them all.


> When I get his machine back I will see if I can duplicate the problem 
> here.

But you just said that "it has worked fine in many installations over 7 
years."  What makes you think that you will be able to duplicate such an 
elusive bug in another (even more predictable) environment?  That seems very 
contradictory to me.  I still think a simple software change to check for 
the exact error would be more effective.

- Dennis 
Re: Weird problem with WNetAddConnection2()
#1580
Author: Bob Reeves
Date: Wed, 18 Jul 2007 20:46
10 lines
1595 bytes
Not disagreeing with you, if the software had better error checking this
problem could have likely been solved by now. We just never ran into a need
till this issue came up. In the past if you could see the other computers on
the network it worked, this is the first instance in over 7 years of the
network working but the software isn't.

Managed to get approval for the replacement computer and he is sending the
problem unit back. If I can duplicate the problem I will write a little
quick and dirty test app with proper error reporting to see if it will tell
us anything.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads