[twsocket] ICS FTP Client Strange Effect
I have an odd effect that I'm sure one of you clever guys will provide an answer to. I am using the FTP client to put a file on the a web site. The file format is of my own making and have no trouble reading and writing to files to/from the hard drive. Apart from the first 4 bytes in the file, the data is stored as Unicode. So in the case of English text every other byte is zero. Now when I putAsync the file and look at the result it has stored every carriage return with the two bytes in reverse order. So $0D, $00 is stored as $00, $0D. Line feeds and all the other text are stored correctly. Am I doing something wrong? The FTP component is as per the default settings. Graham -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client Strange Effect
Graham Powell wrote: I have an odd effect that I'm sure one of you clever guys will provide an answer to. I am using the FTP client to put a file on the a web site. The file format is of my own making and have no trouble reading and writing to files to/from the hard drive. Apart from the first 4 bytes in the file, the data is stored as Unicode. So in the case of English text every other byte is zero. Now when I putAsync the file and look at the result it has stored every carriage return with the two bytes in reverse order. So $0D, $00 is stored as $00, $0D. Line feeds and all the other text are stored correctly. Am I doing something wrong? The FTP component is as per the default settings. Have you tried binary mode yet? -- Arno -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client Strange Effect
Just spotted that with Wireshark. Although Binary mode is set at design time I remember now that I have to set TypeBinaryAsync after the connection is made. Thanks Graham -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Arno Garrels Sent: 14 November 2012 16:05 To: ICS support mailing Subject: Re: [twsocket] ICS FTP Client Strange Effect Graham Powell wrote: I have an odd effect that I'm sure one of you clever guys will provide an answer to. I am using the FTP client to put a file on the a web site. The file format is of my own making and have no trouble reading and writing to files to/from the hard drive. Apart from the first 4 bytes in the file, the data is stored as Unicode. So in the case of English text every other byte is zero. Now when I putAsync the file and look at the result it has stored every carriage return with the two bytes in reverse order. So $0D, $00 is stored as $00, $0D. Line feeds and all the other text are stored correctly. Am I doing something wrong? The FTP component is as per the default settings. Have you tried binary mode yet? -- Arno -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client Strange Effect
Graham Powell wrote: Just spotted that with Wireshark. Although Binary mode is set at design time I remember now that I have to set TypeBinaryAsync after the connection is made. Yep, I and many others had to learn this lesson as well. I vote for Binary as the default mode. -- Arno -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client Strange Effect
I vote for Binary as the default mode. Unfortunately, the standard says text mode has to be the default. -- francois.pie...@overbyte.be Embarcadero MVP http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client - Next question
That seems to be the case. I now just call the TypeBinaryAsync in the ftpConnectAsync event. Thanks again for your help. Graham -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Angus Robertson - Magenta Systems Ltd Sent: 17 July 2012 17:41 To: twsocket@elists.org Subject: Re: [twsocket] ICS FTP Client - Next question I have found that if I call TypeBinaryAsync first and then in the Request event (ftpTypeSetAsync) I now call GetAsync You only need to set type once, and if you are using Async events then OnRequestDone is where you check your state mechanism for the next command. Personally, I mostly use the sync methods, much easier. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] ICS FTP Client - Next question
So now I have another issue which I'm sure someone will know the answer to. I am copying Unicode files from my FTP server to a local directory. The problem is that for every carriage return I get an additional non-Unicode carriage return. So for a CR LF where I should receive 0D 00 0A 00, I get 0D 00 0D 0A 00. This of course has now screwed up the rest of the file as all the bytes are now out of sync. If I copy the file by Drag Drop using Windows Explorer all is fine. Using Wireshark to compare what is sent in each case I see that using the ICS FTP Client the extra 0D is indeed being sent from the FTP server. Using Drag Drop I see a Type I command in the Wireshark display and the data is correct. The ICS FTP Client component has the Binary property set TRUE. Help much appreciated as always. Graham -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client - Next question
The problem is that for every carriage return I get an additional non-Unicode carriage return. The ICS FTP Client component has the Binary property set TRUE. But are you calling the TypeBinary or TypeSet methods that actually send the TYPE command? Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client - Next question
I think you are correct. I have found that if I call TypeBinaryAsync first and then in the Request event (ftpTypeSetAsync) I now call GetAsync then it works. Is this the best way to do it? I guess I thought that just setting Binary to TRUE, it was going to send the TYPE I automatically. Graham -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Angus Robertson - Magenta Systems Ltd Sent: 17 July 2012 15:46 To: twsocket@elists.org Subject: Re: [twsocket] ICS FTP Client - Next question The problem is that for every carriage return I get an additional non-Unicode carriage return. The ICS FTP Client component has the Binary property set TRUE. But are you calling the TypeBinary or TypeSet methods that actually send the TYPE command? Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client - Next question
I have found that if I call TypeBinaryAsync first and then in the Request event (ftpTypeSetAsync) I now call GetAsync You only need to set type once, and if you are using Async events then OnRequestDone is where you check your state mechanism for the next command. Personally, I mostly use the sync methods, much easier. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] ICS FTP Client
I'm sure this problem is simple to solve but I am tearing my hair out trying to solve it. Imagine I have an FTP site that contains a folder called Test1. In this folder I have a file called abc.dat and another folder just called abc. So I log on to the FTP site and change the directory (CwdAsync) to Test1. Now I do a directory listing and I get the file abc.dat and the folder abc. So far so good. Now I change the working directory to Test1/abc. I check with PwdAsync that it is correct and it responds with what I could expect. Next I try and do a directory listing on this folder. The response indicates no error, but the stream is of zero size. So something is obviously not right. Next test performed: I login into the FTP site and change directory straight to Test1/abc. Now if I do a directory listing, I get two directories returned, The single and double dot, but still no filenames. Any help much appreciated. Graham -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client
Now I change the working directory to Test1/abc. I check with Now I change the working directory to Test1/abc. PwdAsync that it is correct and it responds with what I could expect. Next I try and do a directory listing on this folder. The response indicates no error, but the stream is of zero size. LIST only returns file in the current directory, so unless there are files in Test1/abc it will return a blank directory. If you want to list all files in sub-directories you have to traverse the directory free listing each directory and combine all the results, or use an FTP that lists all sub-directories in a single command, ie the ICS FTP server. You can try my File Transfer Components which are high level FTP and HTTP components using ICS that will list sub-directories and copy all the files with a single command. http://www.magsys.co.uk/delphi/magxfer.asp Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client
I may well end up using your components, but in the meantime I need to determine what my problem is here. I use DirAsync to get the directory listing. If I set the directory to Test1 and do a DirAsync, I get all the files and folder names. Now If I set the CWD to one of these sub folders and do a DirAsync again, I get a zero length stream returned. I know there are files in the sub folder as I can see them with Windows Explorer. The curious thing is that when I CWD straight to the subfolder after the Connect event, the DirAsync now returns some data in the stream, but only the dot and double dot folders. Any more clues? Graham -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Angus Robertson - Magenta Systems Ltd Sent: 16 July 2012 14:26 To: twsocket@elists.org Subject: Re: [twsocket] ICS FTP Client Now I change the working directory to Test1/abc. I check with Now I change the working directory to Test1/abc. PwdAsync that it is correct and it responds with what I could expect. Next I try and do a directory listing on this folder. The response indicates no error, but the stream is of zero size. LIST only returns file in the current directory, so unless there are files in Test1/abc it will return a blank directory. If you want to list all files in sub-directories you have to traverse the directory free listing each directory and combine all the results, or use an FTP that lists all sub-directories in a single command, ie the ICS FTP server. You can try my File Transfer Components which are high level FTP and HTTP components using ICS that will list sub-directories and copy all the files with a single command. http://www.magsys.co.uk/delphi/magxfer.asp Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client
I may well end up using your components, but in the meantime I need to determine what my problem is here. The component includes an EXE demo, use that against the FTP server and the same root directory specifying get subdirs, and watch the FTP commands and responses the component uses to parse the directories. Or use a decent FTP client like FileZilla that lists commands and responses. If it also fails to list the subdirs, the FTP server is faulty or maybe set so you can only see the root directory. I know there are files in the sub folder as I can see them with Windows Explorer. Which does not have any FTP functionality, so is this a local FTP server? Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client
I know there are files in the sub folder as I can see them with Windows Explorer. Which does not have any FTP functionality, so is this a local FTP server? You can browse FTP servers with Windows Explorer, you just need to type the address in the address bar. Ex.: ftp://usern...@ftpserver.com You can even tell it to use passive mode by going in Control Panel-Internet Options-Advanced tab hth -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client
I used the demo program from your website in conjunction with Wireshark to monitor what was going on in network land. I then tried my program and the problem was obvious. I knew it would be simple. After doing the GetAsync I had not cleared the HostFilename parameter. So the DirAsync still had this as a parameter. Thanks for all your input. Graham -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Angus Robertson - Magenta Systems Ltd Sent: 16 July 2012 15:46 To: twsocket@elists.org Subject: Re: [twsocket] ICS FTP Client I may well end up using your components, but in the meantime I need to determine what my problem is here. The component includes an EXE demo, use that against the FTP server and the same root directory specifying get subdirs, and watch the FTP commands and responses the component uses to parse the directories. Or use a decent FTP client like FileZilla that lists commands and responses. If it also fails to list the subdirs, the FTP server is faulty or maybe set so you can only see the root directory. I know there are files in the sub folder as I can see them with Windows Explorer. Which does not have any FTP functionality, so is this a local FTP server? Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client
I had not cleared the HostFilename parameter. So the DirAsync still had this as a parameter. This is deliberate, the FTP command 'LIST directory' is valid, but not totally reliable with all FTP servers, it can save a lot of path commands. 'LIST filename' is also how to check if a specific file exists. The XDMLSD command supported by the ICS web server is the most efficient way of getting all directories in a single command. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client
Thank you. You have been very helpful. Graham -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Angus Robertson - Magenta Systems Ltd Sent: 16 July 2012 17:38 To: twsocket@elists.org Subject: Re: [twsocket] ICS FTP Client I had not cleared the HostFilename parameter. So the DirAsync still had this as a parameter. This is deliberate, the FTP command 'LIST directory' is valid, but not totally reliable with all FTP servers, it can save a lot of path commands. 'LIST filename' is also how to check if a specific file exists. The XDMLSD command supported by the ICS web server is the most efficient way of getting all directories in a single command. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] ICS FTP Client
Apart from the first command, under normal circumstances all commands loaded to the FTP client are as a result of a previous FTP client event being generated. Occasionally I am detecting a FTP Component Not Ready error. So the question is: Is there an FTP or some sort of network condition that can produce this error message, or is it more likely that there is some sneaky route in my code whereby a command can be loaded to the FTP client before the previous command has finished. Graham -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client
Apart from the first command, under normal circumstances all commands loaded to the FTP client are as a result of a previous FTP client event being generated. Occasionally I am detecting a FTP Component Not Ready error. So the question is: Is there an FTP or some sort of network condition that can produce this error message, or is it more likely that there is some sneaky route in my code whereby a command can be loaded to the FTP client before the previous command has finished. Yes, it is likely to come from your application. You have to make sure the component has really finished his work, specially in case of error. Use OnrequestDone event to chain next request. Sometimes it helps using PostMessage with a custom message and the writing the code in the corresponding message handler. Using PostMessage append a message to the message queue, meaning that all pending messages will be processed before your own message, so you are sure there is nothing pending. -- francois.pie...@overbyte.be http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client
Apart from the first command, under normal circumstances all commands loaded to the FTP client are as a result of a previous FTP client event being generated. Occasionally I am detecting a FTP Component Not Ready error. So the question is: Is there an FTP or some sort of network condition that can produce this error message There is no network condition that can generate this message. It is internal FTP client error when a new command is issued for RequestDone has been called internally for the previous command. Are you using async or sync FTP commands in your application? If the former, you are totally responsible for not calling another command until the last has finished. Using sync commands, the error can occur if you run the FTP client in a thread without using a message pump in the thread, or an old version of FTP client without a fix I did a month ago. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP Client
It is all Async and I think I am homing in on the problem. Some Drag Drop operation may be butting in the normal sequence of events. Thanks for all your thoughts Graham -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of Angus Robertson - Magenta Systems Ltd Sent: 22 October 2010 16:47 To: twsocket@elists.org Subject: Re: [twsocket] ICS FTP Client Apart from the first command, under normal circumstances all commands loaded to the FTP client are as a result of a previous FTP client event being generated. Occasionally I am detecting a FTP Component Not Ready error. So the question is: Is there an FTP or some sort of network condition that can produce this error message There is no network condition that can generate this message. It is internal FTP client error when a new command is issued for RequestDone has been called internally for the previous command. Are you using async or sync FTP commands in your application? If the former, you are totally responsible for not calling another command until the last has finished. Using sync commands, the error can occur if you run the FTP client in a thread without using a message pump in the thread, or an old version of FTP client without a fix I did a month ago. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] ICS FTP client - more questions
problem I have is that while this file download is active I am also trying to write data to a USB device. There is a certain amout of buffering available but large amounts of network activity prevent the application from servicing the USB port. Is there any way to reduce the overall priority of the FTP client or even the just the data socket so the USB gets more time to be serviced. Using Windows API, you can reduce the priority of your executable and/or reduce the priority of a given thread in your executable. See http://msdn.microsoft.com/en-us/library/ms686219(VS.85).aspx and http://msdn.microsoft.com/en-us/library/ms686277(VS.85).aspx because the Windows networking just hogs CPU resources regardless. Depending on your hardware configuration, it is possible that the network is so fast compared to the processing power that the network eat all power. This is where you should start throttling your network I/O and/or reduce thread/process priority. Of course you may also use a computer with more power. Some high end network card also offload TCP/IP to the card itself, making the network less CPU intensive. You may also have faster disk and more CPU. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] ICS FTP Client list command result
Hi. Just started using the ICS stuff and I can’t figure out where the returned file list is put or access when I issue a LIST of LS command. Checked the source header and FAQ first, but (unless I missed it) I can't see anything on the subject other than the list is placed in a local file. Where? Thanks, Ian Thompson No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.488 / Virus Database: 269.14.10/1070 - Release Date: 14/10/2007 09:22 -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be