Shared folders

S

Senen

Good Day,



I have a problem with a (network) shared folder on my XPE system:

When trying to open a file in this folder from a remote XP machine, the
first time it doesn't work.

I have to manually open Windows Explorer and type \\IPofXPeMachine\ then I'm
prompted for a user name and password.

After the access grant I can shutdown the client machine, stop the app, .
the network access to the shared folder works fine.



The way I share the folder in the XPe machine is simple and it works fine:

Net share MySharedFolder=D:\MySharedFolder.



If anyone has an idea about how to proceed to not have to manually type the
IP address in the explorer and type the username and password.

I would like to open any file in the shared folder without any protection.



Thanks

Senen
 
K

KM

Senen,

If by protection you meant creating an authentication channel between two PCs then all you have to do is to make sure:
- either use matching user accounts on both PCs
- or enable Guest account (on both machines again). Read more about Guest access on XP on the Web.

As for the name of the machine, looks like it doesn't get resolved on your network. Check it out with ping command. Check all the
firewall settings on your XPe device and make sue Server service is up and running on that device.
 
S

Senen

Hello KM,

Thanks for the advises.
There is no problem with the machine name because I use the IP address:
\\192.168.10.1 for example.
I can't have matching user accounts on both machines.
I will look as you suggested in the direction of the Guest account in the
XPE machine.

Thanks again for the help
Senen
 
K

KM

Senen,

I thought you asked how to avoid typing IP address of that machine in Explorer.

You can also use "net use <drive letter> \\IP\sharename /USER:<user> password" command to map the share. This way you can use the
proper user account credentials even if they are different on both PCs.
 
S

Senen

Hello KM,

My problem is as following:
The HMI working on the remote PC (Windews XP or 2000) has to access files
located in the XPe machine.
After sharing the folder in the XPe machine with the command:
net share MyShareFolder=D:\MyShareFolder
The HMI program performs a simple
fd=fopen("\\xxx.xxx.xxx.xxx\MyShareFolder\MyFileName.xxx",...);
This works fine but the first time the HMI app is running on a remote PC,
the access to the file in the shared folder of the XPe target is denied.
If manually I open the explorer and type in the address bar:
\\xxx.xxx.xxx.xxx then I will be prompted for a username and password.
After that the access from the HMI program works fine.

What I would like is to find a way (some extra code in my HMI program) where
I can send the username and password to avoid the user to have to go through
the explorer and manually type the IP address of the XPe machine, the
username and the password.

I suppose that your command to define a network drive would work, the
problkem is that I don't know which driver letter is available and there is
still a manual command to perform.

Thanks
Best Regards
Senen
 
K

KM

Senen,

There are multiple ways how to create an authentication channel between to Windows PC. Depending on the language your HMI app is
written in it may be easier to use API (like WNet functions) or script (WMI objects) or directly issue the net.exe command.

Please note that for the net.exe command I showed earlier it is safe to leave the drive letter out. Then only the authentication
channel is created (if the user credentials are properly provided within the command) but no drive mapping happens. then you can
safely access the server PC shared resources from the other PC where the channel was created from (certainly I refer to the
resources available for the user account used).

In other words, the follwoing command should do it:
net use \\IP\sharename /USER:<user> password
 
S

Senen

I looked at the documentation about the WNetAddConnection2 and it sounds
good.
I will try to put it in my code.

Thanks for your help
Senen
 
S

Senen

KM,

I did some tests with the net.exe command and I get the same result as with
the explorer.
It looks to be the easiest way to create the authentication channel.
I will also try the WNet functions in the future.

Thanks again for your help
Senen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top