en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en nl en en en en en en en en en en en en en en en en en en en en en en en en en pl en en en en nl en en en en en en en en hbs_lat pl en hbs_lat pl en en en en en en en nl en en en en en en en en fr en da en en en en nl en en en en en en la en en pl en en en en nl en en en en en la en en en hbs_lat pl hbs_lat pl en en pl en en en en nl en en en en en en en hbs_lat pl hbs_lat pl en en en en nl vi en en en en en en en en pl en en en en nl en en en en hbs_lat pl hbs_lat pl en en en en en en en nl fr en en en en fr en da en en es en en en en nl en en en en en en en en en en en nl en en en en en la en en en en en en en nl en en en en en en es en en en en nl en en en en en en en en es en en en en nl en en en en en en en en en fr en en en en nl en en en en en en it en en en en en es en en en en nl en en en en en en en en de en en en fr en en en en en en en en en pt en en en en en en
FTP file from host to client after first receiving file from client - PowerBASIC Peer Support Community
By logging into your account, you agree to our Privacy Policy, personal data processing and storage practices as described therein.
Forgot password or user name?
Search in titles only Search in Programming the Internet only
You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
FTP file from host to client after first receiving file from client
All Time Today Last Week Last Month
All Discussions only Photos only Videos only Links only Polls only Events only
Hello, I am trying to use network transfer and windows functionality I am unfamiliar with to accomplish the following:
Sorry for the long winded explanation but I've found it more useful to be verbose on the front end for clarity's sake.
The first file transfer is initiated by my product to my computer after it is installed at the customer's home and that works fine. The product initiates the FTP session, my computer has an FTP server listening and waiting, the file is received and the session is closed. During that first transfer from the my product in the customer's home to my computer, I would like to be able to capture the necessary information needed to do a file transfer in reverse: initiating an FTP file transfer from my computer back to my product at a later time (event based).
To summarize what I would like to do and the subsequent file transfer path:
I can do an FTP Get command from my product to my computer but I also need to have the ability to initiate a transfer from my computer to my product based on specific events. I do realize that if the home owner's cable modem's IP address changes prior to my product's next file upload into my computer, I would not be able to communicate to that particular unit until I received it's next file transfer where I could then capture the new IP address and then push the file to the unit.
As I see it, I face a number of problems that I know about and undoubtedly a larger number of problems I am unaware of:
1) Is it possible to capture the home owner's cable modem IP address during the FTP session initiated from the product to my computer? if so, what PB code would help facilitate capturing that IP address and where within my FTP server code would I insert it? Part of the reason I want the home owner's IP address is that I realize it will change over time so I need to capture it and compare it to that product's previously sent IP and update if it has changed. I've seen some very daunting WinSock code in some of the source code examples and it's far beyond the type of programming I am familiar with Relevant post on ws2_32.dll
2) What information is needed for my computer to initiate an FTP file transfer back to my product? Even if I have the IP address of the home owner's cable modem, is that enough to be able to initiate an FTP file transfer to my product from my computer given all the routers I have to go through? Is there additional information I need like the MAC address from my product's wi-fi card or the IP address of the wireless router in the customer's home as assigned by the home owner's router? What PB code would help to collect all the necessary information so I could FTP back to my product?
3) How reliable would this process be if it could be accomplished (excluding what I already know about the problem of the home owner's cable modem IP potentially changing over time). Will software fire walls in the home owner's computer prevent the transfer back to the product? What would I have to tell the home owner to do or not do to his router to make this happen (hopefully not much)? If the IP address of my router changes (as issued by the home owner's router running DHCP) will that cause problems? etc.
4) What would I have to require from the home owner to do to his router to allow the file to be uploaded to my product (ex. packet forwarding)? My goal is for the home owner to not have to do anything to their router outside the normal default settings of the router since I can't rely on the settings remaining the same in case they change out their router or reset it.
5) Less important at this time but will be important in the future: what steps should I take to make the FTP transfer from my computer to the product more secure (I'm less concerned with the transfer from the product to my computer). I have less capabilities at my product's side of things since it's not a computer running an OS. Things like
If there is a PB library that would help facilitate this ie. allow me to write easier code at a higher level (rather than getting down to the WinSock level) I would be happy to purchase it (something similar to Marshallsoft's TCP/IP Library, although there's no PowerBuilder version). As far as I can tell there's nothing the the Marshallsoft's FTP Client software that I already own to accomplish any of this (I could be wrong).
I found functions like gethostbyaddr() in the WS2_32.inc in some of the sample code posted but I'm not sure if that's what I need or how to implement appropriately.
Easy to understand code samples would be much appreciated. If you have some insight on a particular question, please reference which number (1-5) you're answering for ease of discussion.
Thanks very much for your help! The PB forums is one of the main reasons I went with this product.
Last edited by ; 31 Aug 2009, 01:39 PM.
Tags: client, ftp, host, ip address, marshallsoft, router, tcp/ip
Join Date: May 2008
31 Aug 2009, 11:42 AM
Originally posted by Robbie Clark View Post
Abstract: I am trying to capture enough information from a client during an FTP file transfer from the client to my host computer so that I can initiate an FTP file transfer back to the client at a later time.
The short answer is that you can't do this with a client/server setup. FTP servers wait for requests from FTP clients. They cannot "push" data to clients nor force a client to initiate a request.
What you're describing is peer-to-peer networking, where both processes can act as both a client and a server.
I'm not saying that you will not be able to accomplish your data transfer goals, just that you will not be able to get a generic FTP server to initiate any type of data transfer with a generic FTP client.
[edit] I thought I would add the following: The simplest approach would be to build some type of polling mechanism into your client-side product. At some regular interval it would poll a process on your server and, if necessary, initiate the FTP request from the client side. This also avoids some of the floating IP, and security issues.
Last edited by Kevin Powick; 31 Aug 2009, 11:51 AM. Reason: added thought, fixed spelling and grammar
Join Date: Aug 1998
31 Aug 2009, 12:37 PM
May be useful, maybe not....
WinInet FTP Upload (Overwrite or Append) Demo 3-10-08
Last edited by Michael Mattias; 31 Aug 2009, 06:21 PM. Reason: Corrected Link
Port Washington WI USA
31 Aug 2009, 12:39 PM
update: wireless module has both client and server ability
Something I left out in the description of the Roving Network wireless module inside my product in the customer's home: it has the ability to act as both an FTP client and server if that would help to initiate the push process from my host FTP server. I would still need to capture the necessary information from the product's initial FTP transfer to my host computer in my home.
Join Date: May 2008
31 Aug 2009, 01:45 PM
Originally posted by Robbie Clark View Post
Something I left out in the description of the Roving Network wireless module inside my product in the customer's home: it has the ability to act as both an FTP client and server if that would help to initiate the push process from my host FTP server. I would still need to capture the necessary information from the product's initial FTP transfer to my host computer in my home.
But the issue is that you want the server at your office to initiate some type of push/transfer. In that case, the office server would need to act as a client to initiate communication with the customer side now acting as a server.
I still think you're looking at a somewhat complex solution with such an approach. It would be much, much easier to have the client poll your server at regular intervals. The implementation should be very easy and the network overhead is very low. No more than an e-mail client doing a POP3 mailbox check. You can even think of it that way. Client ask server, "Is there anything for me?" If yes, then client initiates the FTP transfer.
Again, it avoids problems with IPs that might change and alleviates some security concerns on the client side.
Join Date: May 2008
31 Aug 2009, 01:47 PM
Originally posted by Michael Mattias View Post
May be useful, maybe not....
WinInet FTP Upload (Overwrite or Append) Demo 3-10-08
Link doesn't work for me.
31 Aug 2009, 02:56 PM
I agree Kevin. Thanks again for your suggestion, it would be much easier to have the client poll the server at specified time intervals to see if a file needs to be retrieved. However, my requirements stipulate that I need the ability to initiate the transfer from my computer to the product based on an event in case I can't wait for the next scheduled poll to take place. We are looking at an installation of over 10,000 units installed in client's homes and can't have them all pinging the server several times per minute to see if a new file exists to get.
This link should work to that file posted above
Join Date: May 2008
31 Aug 2009, 04:16 PM
Thanks for the additional information with regard to the scale of your deployment. I guess you'll have to look at some type of P2P approach.
Join Date: Aug 1998
31 Aug 2009, 06:22 PM
Port Washington WI USA
Join Date: Feb 2005
1 Sep 2009, 06:16 AM
Does this have to be FTP?
Client could execute a "TCP CLIENT/HOST" program at boot-up.
You would receive the IP, port, client number and anything else you need.
If files are available, they could TCP RECV them immediately or check at intervals.
This enables sending or receiving on either end.
1 Sep 2009, 09:33 AM
Great suggestion Mike. I think that would actually do the trick. After I reread the documentation on the Wi-Fi module, the transfer does not have to be FTP. I will look into how to pull the IP out of the incoming TCP Client stream. If you know of any code that would help facilitate grabbing the incoming IP that would be great. I'll dig around the code depot.
Join Date: Feb 2000
5 Sep 2009, 12:23 PM
Forget about using FTP and and just do your own simple information transfer package. If at the start the client computer first sends a UDP packet to your static IP server then the IP address that is available in the standard UDP RECV statement will be the external IP address of the clients router/modem.
From that point as you know the IP addresses of both ends you can establish any sort of TCP/IP conversation you wish.
Join Date: Feb 2005
7 Sep 2009, 09:40 AM
I have been working with a TCP server and transmiting a 100,000,000 byte file in about 17 seconds. 10 megabytes in about 1.2 seconds.
This is up and down the internet within my own network.
If anyone is interested in seeing what type of performance is obtained between our networks (cable or dsl) please let me know and I'll put
together a test. This makes FTP look like a snail.
Join Date: Feb 2005
17 Dec 2009, 08:11 AM
If you know of any code that would help facilitate grabbing the incoming IP that would be great. I'll dig around the code depot.
Better late than never.
FUNCTION TCPADDR(BYVAL lSock AS LONG) AS STRING 'Paul Purvis code to get remote IP and port from client LOCAL sa AS sockaddr_in LOCAL l AS LONG LOCAL lHandle AS LONG LOCAL b AS BYTE PTR LOCAL lSockHandle AS LONG lSockHandle = FILEATTR(lSock,2) l = SIZEOF(sa) IF getpeername(lSockHandle, BYVAL VARPTR(sa), l) = 0 THEN b = VARPTR(sa.sin_addr.s_addr) 'return IP address of connection FUNCTION = USING$("#_.#_.#_.#", @b, @b[1], @b[2], @b[3]) + " on remote port" + STR$(sa.sin_port) END IF END FUNCTION
Join Date: Sep 2010
8 Sep 2010, 02:38 AM
I am trying to use wifly product to send and receive files from my product (8051 procesor) to a FTP server, such as windows 2003 server. My product initiates the FTP session, user, password... I can make directory, delete files, create an empty file, but i dont know how to transfert data in the files, is it posible to acces to the data connection (generally port 20)?
I have the same problem with the LIST command, i obtain:
150 Opening ASCII mode data connection for file list
but where are the datas???
Thanks for your help
Join Date: Feb 2005
8 Sep 2010, 08:59 AM
This shows the public IP address the client needs to report to the server.
Copyright © 1998-2022 PowerBASIC Tools, LLC - All Rights Reserved.
Powered by vBulletin® Version 5.7.0
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved.
All times are GMT-5. This page was generated at 05:33 AM.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.