Results 1 to 14 of 14

Thread: [RESOLVED] how to write text file to remote computer

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2013
    Posts
    1,126

    Resolved [RESOLVED] how to write text file to remote computer

    I know how to write text to file using vb6 if that is on the local computer only? but what if that is between remote computers of different public IP address?

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,905

    Re: how to write text file to remote computer

    Can you explain first what you want to accomplish?
    For what kind of program is this functionality needed?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    May 2013
    Posts
    1,126

    Re: how to write text file to remote computer

    What I want to accomplish is to write a text to a file in the remote computer. it is somehow a resemblance of chat using vb6.

    Perhaps you may advice to do the other ways but I would like to stick what I want to do.

  4. #4
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,905

    Re: how to write text file to remote computer

    You can not just write something on a different computer without a kind of client/server model

  5. #5
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: how to write text file to remote computer

    Well you can if the other computer is on the same LAN and is sharing a folder with write permissions but you can't just write to a remote pc over the internet. If that were the case I would not be connected to the internet

  6. #6
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,905

    Re: how to write text file to remote computer

    @DM, sharing is a kind of client/server model, another possibility could be using FTP (FTP server on remote, FTP client on local), etc etc

  7. #7
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,937

    Re: how to write text file to remote computer

    Are we talking about a computer on the same LAN (or possibly WAN)? If that's the case, it's as simple as:

    Code:
    Dim iFle as long
    iFle = FreeFile
    Open "\\machinename\sharedfoldername\myfilename.txt" For Output As iFle
    
    ... write the file.
    
    Close iFle
    And yeah, if it's not on the LAN (or possibly WAN), then, as Arnoutdv suggested, you're getting into setting up some FTP protocols, which is somewhat more involved.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  8. #8
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: how to write text file to remote computer

    Also note that FTP will only allow you to do so if there is an FTP server running on the target machine and you have a valid userid and password for it which in the case of most pcs there will not be an instance of this running.

    Basically unless the target PC is running an OS prior to XP like Win9x for example which does not require you to define a password for network access of shared folders.
    You will need to know a valid user ID and Password to connect to the PC and write a file plus that pc must be on your network and must allow write access to the folder in question.

    If the PC is running a FTP server then you can use FTP to upload a file
    If you have a TCP client/server with one end on the target and one on the local and they are connected then you can send data to the target and have it written there by the piece that is running on that system.

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: how to write text file to remote computer

    Quote Originally Posted by codesearcher View Post
    ... but what if that is between remote computers of different public IP address?
    While phrased a little awkwardly, this would seem to rule out LANs - at least any normal ones. It sounds like both machines are on separate networks behind separate NAT routers, most likely connected only via the public Internet.

    FTP is a clumsy choice for file transfers in such scenarios. WebDAV is far more friendly in practice, and the redirectors built into Windows can make the remote WebDAV host look like a network drive. This allows a program doing regular sequential file I/O or even Windows Explorer to be used as the client software, unlike FTP.

  10. #10
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,937

    Re: how to write text file to remote computer

    Oh wow, I use a bit of WebDAV on my Windows Home Server, but never messed with it with VB6. I use it to try and edit .DOC and .XLS files, using my WHS like a cloud, but it was always a touch glitchy, but maybe it'd be fine with a simple text file that's quickly written. Using it with Office, after being burned a couple of times, I just got into the habit of downloading my DOC (or XLS) file, making changes, and then re-uploading.

    And sadly, Microsoft recently took down their homeserver.com site, so my WHS box is reduced to being nothing but a NAS box.

    However, after just having read the Wikipedia page on WebDAV, it appears that others may be having better luck than me with it. IDK, maybe it was just the slow upload speed that I could get from my ISP for my WHS.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: how to write text file to remote computer

    Some alternatives include IIS (supports a separate WebDAV extension), BarracudaDrive, and Apache Jackrabbit Standalone Server.

    Oops, too slow. Yes a WHS box can run IIS/WebDAV.

    A big problem with Office document binary formats is they are often fiddled with using a lot of random I/O, being OLE Structured Storage files. They can be hazardous even using LAN shares.

    Part of the reason for the newer "open" XML formats was to get around this. Now Office apps just assume you have a ton of RAM, so they just slurp everything in to work on it and they write it all back out sequentially to save.
    Last edited by dilettante; Nov 19th, 2014 at 12:10 PM.

  12. #12
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: how to write text file to remote computer

    As long as we're tossing out different ideas: how about a database? The clients would connect, read any new data, write new data, then disconnect.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  13. #13

    Thread Starter
    Frenzied Member
    Join Date
    May 2013
    Posts
    1,126

    Re: how to write text file to remote computer

    thanks for your inputs guys. so I guess writing text file to remote computer over wan is not possible other than ftp and other approach that you mentioned.

    Closing this thread now.

  14. #14
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,937

    Re: [RESOLVED] how to write text file to remote computer

    codesearcher,

    You said one word in your closing statement that's probably going to flare this thread back up, and that word is "WAN". The word WAN (or wide-area-network) is not totally nailed down, but I think most people consider it something that's somewhat different than, say, the internet. The WANs I'm familiar with (which is multi-site hospital WANs) allow you to address machines by machine name across the WAN. If someone has shared a folder and they're on the WAN, I can directly open and write to it, so long as I have adequate privileges.

    If it's the kind of WAN I'm familiar with, then my post #7 still applies.

    You take care,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width