Liberty BASIC Community Forum
« Retreving a file over local network »

Welcome Guest. Please Login or Register.
Nov 22nd, 2017, 01:31am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Retreving a file over local network  (Read 784 times)
Tasp2
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 142
xx Retreving a file over local network
« Thread started on: Mar 4th, 2015, 12:34pm »

As the title suggests, I'm trying to "Load" a file from a remote computer on the same local network, once I've updated the file I need to "Save" it back to the remote computer.

Now I've done this before using FTP and a remote file from the internet with liberty but never direct via IP on a LAN.

I know natively LB can't do it, but can it be done?

I've tried using a shared folder on the remote machine, but despite having accessed the remote folder via windows explorer and "unlocking" with user and password, LB still cannot access it, again think this will be because LB doesn't have access to the file because it's not logging in. I cannot find a way for LB to pass the user/pass, despite searching. I would prefer not to share a folder but rather to access via IP.
User IP Logged

Mystic
Junior Member
ImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 97
xx Re: Retreving a file over local network
« Reply #1 on: Mar 4th, 2015, 5:35pm »

If you have the rights into the other machine I would imagine you can just do something like this...

Code:
OPEN "\\computer_name\c$\index.html" FOR OUTPUT AS #indexHtml

        PRINT "Hello"

CLOSE #indexHtml

 
« Last Edit: Mar 4th, 2015, 5:36pm by Mystic » User IP Logged

- Rick
Programming BASIC since the 80's starting with a TRS-80.
metro
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 194
xx Re: Retreving a file over local network
« Reply #2 on: Mar 4th, 2015, 9:50pm »

I have a setup where I have mapped a folder on my Linux Desktop as drive "z:" on my Win7 laptop and can read and write to files in the mapped drive.

winXP and above look at "net use" command

It maybe another option for ypu
User IP Logged

Win10 64 HP laptop + desktop Mint Linux 64bit
Tasp2
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 142
xx Re: Retreving a file over local network
« Reply #3 on: Mar 6th, 2015, 12:52pm »

Thanks for the replies.

I can do this by mapping the folder on the remote machine.

But I would rather not, as it would require the end user to set this up.

I was hoping there was another way?

If not then I'll have to use mapping.
User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5567
xx Re: Retreving a file over local network
« Reply #4 on: Mar 7th, 2015, 09:43am »

I am no expert in network traffic but what I would say is you might be swimming against the tide. For a remote program to force a file down to a client is battling all of the virus protections that exist.

Since you know we can download files would it not be simpler to use some of the example code that seeks out updated files and downloads newer versions.

In this way your client computer is in control and doing something that is " normal"
« Last Edit: Mar 7th, 2015, 09:44am by Rod » User IP Logged

Tasp2
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 142
xx Re: Retreving a file over local network
« Reply #5 on: Mar 8th, 2015, 10:38am »

Well, I had considered this however the computers are all on a LAN with no wan connection so AV and firewall will be enabled etc.

However I've decided to go simple with this a use a mapped drive on the main "server" since my program communicates via ip for the main comms but relies on the server holding the original file which the client collects only as it start and resends an updated file back when the program is ended.

This worked fine yesterday no problem.

However when I started both machines this morning to continue development, for some reason LB can't access the file, or more to the point says it cannot find it?
But I can navigate to the remote folder and both read and write and create new files. Tried changing the permissions etc. Tried remapping the drive and nothing! ?
And yes tried copying the hard coded filename into windows explorer and it open the file no probs.
User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5567
xx Re: Retreving a file over local network
« Reply #6 on: Mar 9th, 2015, 02:30am »

Use CtrlAltDel start the task manager and check Liberty is not hung in the background. If your program had crashed it could be holding the file open and unavailable to other programs. Or simply reboot.
User IP Logged

Tasp2
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 142
xx Re: Retreving a file over local network
« Reply #7 on: Mar 9th, 2015, 1:09pm »

Unfortunately this I've tried already.
Both machines have had a reboot several times.
Remapped the drive. New letter, different folder etc.
Main machine is win 7 (server) other is vista (client).

Edit: will open/save with notepad no problems
« Last Edit: Mar 9th, 2015, 1:12pm by Tasp2 » User IP Logged

Stefan Pendl
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Computers are like babies, you must teach them what you like them to do ...


Homepage PM

Gender: Male
Posts: 5297
xx Re: Retreving a file over local network
« Reply #8 on: Mar 9th, 2015, 3:46pm »

Does the path contain any special characters?

I use mapped drives without problems for years now, so there must be another problem.
There is a problem with UNC paths, but not with mapped drives.
User IP Logged

Stefan

Make sure to read and follow the Forum Guidelines

Liberty BASIC Pro 4.04, Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
Tasp2
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 142
xx Re: Retreving a file over local network
« Reply #9 on: Mar 9th, 2015, 5:41pm »

Yes I read there is a problem with UNC, thats why I added it as a "mapped network drive" rather than "Adding network location"

No special chars, the path is
Code:
Z:\layout.dat
 


EDIT: I'm also running LB as Administrator.
« Last Edit: Mar 9th, 2015, 6:03pm by Tasp2 » User IP Logged

Chris Iverson
Administrator
ImageImageImageImageImage


member is offline

Avatar

20% Cooler


Homepage PM

Gender: Male
Posts: 2285
xx Re: Retreving a file over local network
« Reply #10 on: Mar 9th, 2015, 7:52pm »

Running as administrator may actually be the problem. It might also be running under a different user.

If I recall correctly, as a security precaution, mapped network drives are not shared between users of the same computer, and are not shared between administrator-level and user-level instances of the same user.

There are a few ways around this.

1) Run the program in standard user mode.

2) Map the drive while using full admin-level privileges(easiest way to do this is to launch the command prompt as administrator and use the NET command to map the drive, or have your program do the mapping)

3) Use a registry tweak to disable the connection separation.
« Last Edit: Mar 9th, 2015, 7:52pm by Chris Iverson » User IP Logged

"Do you believe in destiny?" - Pyrrha Nikos, RWBY
"With what wish will your Soul Gem shine?" - Kyubey, Puella Magi Madoka Magica
Tasp2
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 142
xx Re: Retreving a file over local network
« Reply #11 on: Mar 11th, 2015, 12:50pm »

Right, well this is a "security" issue.

If I map the drive and don't run LB as admin then it will access the drive no problem.

If I "net use" the drive from the command prompt run as an administrator and LB as administrator it works.

But I'm the only user on this machine and user has admin privs?

Strange but this works.

Thanks everyone.

« Last Edit: Mar 11th, 2015, 12:51pm by Tasp2 » User IP Logged

Chris Iverson
Administrator
ImageImageImageImageImage


member is offline

Avatar

20% Cooler


Homepage PM

Gender: Male
Posts: 2285
xx Re: Retreving a file over local network
« Reply #12 on: Mar 11th, 2015, 1:48pm »

As an additional security boundary, programs started by administrator-level users will still run only with standard user permissions unless explicitly granted elevation. Thus, even for the same user, programs can see two different "worlds"; standard-user and admin-user.

Because of the fact that admin-level and standard-level processes can be launched under the same user, mapped drives(among other things) are separated by the security boundary instead of by user, to prevent information disclosure.

(i.e. admin-level process maps a drive to gather some data; standard-level process won't be able to grab that same data from the drive without mapping it itself).
User IP Logged

"Do you believe in destiny?" - Pyrrha Nikos, RWBY
"With what wish will your Soul Gem shine?" - Kyubey, Puella Magi Madoka Magica
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls