• Print

Author Topic: an ip address  (Read 287 times)

Namyegob

  • Newbie
  • *
  • Posts: 19
    • Email
an ip address
« on: May 12, 2012, 10:42:27 AM »
Howdy ev1! First i'd like to express my sincerest gratitude for this site, and for the timely responses that i've received & most especailly to Terry Ritchie for helping me to overcome a HUGE obstacle in upgrading my knowledge from Qbasic 4.5 to QB64!!! That being said, i was wondering if there was a way to put an ip address into the path of an image file in order to run the program i'm working on from any computer on my small home network?  thanks for your time and consideration! your cooperations is greatly appreciated.

DSMan195276

  • Hero Member
  • *****
  • Posts: 2035
  • Yes
    • Email
Re: an ip address
« Reply #1 on: May 12, 2012, 10:49:11 AM »
That's a bit more complicated then it seems. To be able to access a image from anywhere, the computer with the image needs to have some type of file sharing setup (Windows has file sharing for local network).

I would recommend finding out how your OS does file sharing, set it up for sharing on the network. Once that's done, then you can just access it like a normal file and the OS will handle all the network stuff.

Matt
"Cast your cares on the Lord and he will sustain you; he will never let the righteous be shaken" -- Psalm 55:22
QB64 Linux Installer

Namyegob

  • Newbie
  • *
  • Posts: 19
    • Email
Re: an ip address
« Reply #2 on: May 12, 2012, 11:37:36 AM »
Thanks Matt!  i thought that i had found a work-around by making a seperate sub with the paths to the files in it & put the seperate sub in an "$INCLUDE" statement as the last statement, but i got an error telling me that the name of the seperate sub was already in use??!?

TerryRitchie

  • Hero Member
  • *****
  • Posts: 2269
  • FORMAT C:\ /Q /U /AUTOTEST (How to repair Win8)
    • Email
Re: an ip address
« Reply #3 on: May 12, 2012, 11:53:50 AM »
What you are referring to is called a UNC (Universal Naming Convention) path, like this:

\\10.36.5.50\c$\pictures\mypicture.jpg   (directly access a file using IP address)
\\ServerPC\c$\pictures\mypicture.jpg     (directly access a file using the computer name associated with 10.36.5.50)

As DSMan pointed out this is inherent to the file sharing properties of the OS. Now, this *may* work on your local network inside QB64, but will most definitely not work outside of your network.  For example:

mypicture& = _LOADIMAGE("\\10.36.5.50\c$\pictures\mypicture.jpg", 32)

will most likely work as long as you are connected to the same network as 10.36.5.50, that is, your subnet masks will match and your IP will be on the same subnet:

10.36.5.100     (your IP)
255.255.255.0  (Your subnet mask)

10.36.5.50       (remote PC's IP)
255.255.255.0  (remote PC's subnet mask)

Given your two IP addresses and subnet masks you are both on network 10.36.5.0

  • Print