[twsocket] THttpServer How to receive posted files
Hello all I have a problem with THttpServer, I want to receive files via POST but I don't know to do this, please if any body can showme an example. thanks in advance. -- 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
Re: [twsocket] How can we automatically set timeout in FTP
Hello Arnold, > need to do these transfers step by step and stop it in case of problem. I > cant download or upload several files in same times; thats why Im using > synchronous methods and not asynchronous. I understeand, but that is not a reason to go sync or async. For example if you need to execute code after a button has clicked you also dont write sequetial code, I assume you put it in OnClick. Wit async components it is the same, and event is the signal to execute next action, and depending on the state of the several events and eventually the error codes the next action can be different. > And for the timeout, if I asked if there is a method to know the > connection type or connection speed, its because users can use this system > with high speed connection or very low speed connection. If you use async you dont have to worry. Winsock will timeout / drop the connection / whatever. > My English is not very good so I hope that Im clear ! It's clear. English is not my mother's tongue also :) --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz -- 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
Re: [twsocket] FTPClient and strange behaviour
Markus Humm wrote: >> If authentication is required to issue a command the server should >> send an error code, typically 530. > > Okay, will pay attention to it. Is there any short overview of the > FTP-protocols available? Afaik the RFCs are a bit longish I fear. RFCs are the standards, there's no way around. >> In order to set transfer mode you must set property BinaryMode to >> TRUE as well as issue command TypeSet to send the transfer type >> command to the server. Same when switching back to ascii except >> property BinaryMode must be set to FALSE before issuing the TypeSet >> command. > > Okay, didn't know that. Will try out that typeset command. But why has > FtpCli a property for transfer mode then anyway? It's easier having a boolean instead of recalling parameters of char 'I' and 'A'. >> Very unlikely, try to upload with FtpTst demo first. If that works >> the problem should be in your code. > > I've tried that and the very same happens here! Is the server buggy? Which FTP server are you using? --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html > I'll try the mentioned things above (might take some days) and report > back. > > Greetings > > Markus -- 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
[twsocket] FTPClient and strange behaviour
Hello, > Markus Humm wrote: >> I've tried the FTPTst Application right now and found out that a PASS >> is required after a open, it will delete the file then. But why >> didn't the server tell me in my program and always claimed to have >> carried out my delete request? > > If authentication is required to issue a command the server should send > an error code, typically 530. Okay, will pay attention to it. Is there any short overview of the FTP-protocols available? Afaik the RFCs are a bit longish I fear. > >> Doesn't really matter, because the put still only works for the second >> time. > > No problem here using FtpTst demo and FileZilla server. > >> As I noticed he tries to open a binary connection although I >> left "binary mode" unchecked. > > In order to set transfer mode you must set property BinaryMode to TRUE > as well as issue command TypeSet to send the transfer type command to > the server. Same when switching back to ascii except property BinaryMode > must be set to FALSE before issuing the TypeSet command. Okay, didn't know that. Will try out that typeset command. But why has FtpCli a property for transfer mode then anyway? > >> What's happening here? I'll need a >> binary transfer later, but not at this time. >> >> Why the need of a 2nd put? Why does the first one fail? Is it my >> FTPServer? > > Very unlikely, try to upload with FtpTst demo first. If that works > the problem should be in your code. I've tried that and the very same happens here! I'll try the mentioned things above (might take some days) and report back. Greetings Markus -- 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
Re: [twsocket] THttpCli v6 - Relocation Problem
Frans van Daalen wrote: > Arno, > > I tested this url and your change (only GetHeaderLineNext) and yes > with connection "keep-alive" of no setting on connection all is fine. > However with connection set to "close" the relocation fails on the > third one. If I try to find where it hangs it shows > > DoRequestSync > Application.ProcessMessages > with fstate = httpwaitingbody. Hmm, I'm still not familiar with this component (looks rather complicated), however that error doesn't happen if I include the second change. Just tested HTTP1.1 with Connection := 'Close' successfully, are you able to reproduce the same? Arno > > > - Original Message - > From: "Arno Garrels" <[EMAIL PROTECTED]> > To: "ICS support mailing" > Sent: Tuesday, July 04, 2006 8:07 AM > Subject: Re: [twsocket] THttpCli v6 - Relocation Problem > > >> Frans van Daalen wrote: >>> If you want me to >>> check it in detail just let me know and I will do so for you. >> >> Thanks, could you please check my small changes below? Try with both >> HTTP 1.0/1.1, with as well as w/o property Connection set to 'Keep- >> Alive'/ 'Close'. >> It's working here using GET, only I'm not sure whether it might have >> some other side effects, RequestDone is not triggered on each >> relocation. Problem URL: >> http://feeds.feedburner.com/foxsports/RSS/headlines?m=4765 leads to >> three relocations, first goes to a different host. >> >> >> 1 - procedure THttpCli.GetHeaderLineNext >> >> [..] >> { FContentLength = -1 when server doesn't send a value } >>if ((FContentLength = -1) and { Added 12/03/2004 } >>((FStatusCode < 200) or{ Added 12/03/2004 } >> (FStatusCode = 204) or{ Added 12/03/2004 } >> (FStatusCode = 301) or{ Added 06/10/2004 } >> (FStatusCode = 302) or{ Added 06/10/2004 } >> (FStatusCode = 304) or{ Added 12/03/2004 } >> (FStatusCode = 401) or{ Added 12/28/2005 } >> //AG 12/28/05 >> (FStatusCode = 407))) { Added 12/28/2005 } >> //AG 12/28/05 >> or >>(FContentLength = 0) >> or >>(FRequestType = httpHEAD) then begin >>{ TriggerHeaderEnd; }{ Removed 10/01/2004 } >>if {(FResponseVer = '1.0') or (FRequestVer = '1.0') or} >> { [rawbite 31.08.2004 Connection controll] } >>FCloseReq then begin >>if FLocationFlag then { Added 16/02/2004 >> }StartRelocation{ Added >> 16/02/2004 }else begin { >> Added 16/02/2004 }if FRequestType = httpHEAD >> then begin { Added 23/07/04 } >>{ With HEAD command, we don't expect a >> document } >>{ but some server send one >> } >>FReceiveLen := 0; { Cancel received >> ta } >>StateChange(httpWaitingBody); >>FNext := nil; >>end; >>FCtrlSocket.CloseDelayed; { Added 10/01/2004 >> }end; >>end >> => else begin // not FCloseReq >> => if FLocationFlag then >> => StartRelocation >>else >>SetReady; >> => end; >>Exit; >>end; >> [..] >> >> >> 2 - Not so important, but LocationChangeCurCount has been counted >> incorrectly. >> procedure THttpCli.StartRelocation >> [..] >>FRcvdCount:= 0; >>FReceiveLen := 0; >>FHeaderLineCount := 0; >>FBodyLineCount:= 0; >> >>if {(FResponseVer = '1.1') and} >>{ [rawbite 31.08.2004 Connection controll] } >> (FCurrentHost = FHostName) and >> (FCurrentPort = FPort) and >> (FCurrentProtocol = FProtocol) and >> (not FCloseReq) then begin { SAE 01/06/04 } >> >>{ This block moved 03/07/2006 } >> => { V1.90 25 Nov 2005 - restrict number of relocations to >> avoid continuous loops } >>inc (FLocationChangeCurCount) ; >>if FLocationChangeCurCount > FLocationChangeMaxCount then >> beginAllowMoreRelocations := false; >>if Assigned (FOnLocationChangeExceeded) then >>FOnLocationChangeExceeded(Self, >> FLocationChangeCurCount, >> AllowMoreRelocations);if not AllowMoreRelocations then >> beginSetReady; >>exit; >>end; >> => end; >> >>{ No need to disconnect } >>{ Trigger the location changed event 27/04/2003 } >> [..] >> >> >> --- >> Arno Garrels [TeamICS] >> http://www.overbyte.be/eng/overbyte/teamics.html >> >> >> Frans van Daalen wrote: >>> - Original Message - >>> From: "Arno Garrels"
Re: [twsocket] THttpCli v6 - Relocation Problem
Arno, I tested this url and your change (only GetHeaderLineNext) and yes with connection "keep-alive" of no setting on connection all is fine. However with connection set to "close" the relocation fails on the third one. If I try to find where it hangs it shows DoRequestSync Application.ProcessMessages with fstate = httpwaitingbody. - Original Message - From: "Arno Garrels" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Tuesday, July 04, 2006 8:07 AM Subject: Re: [twsocket] THttpCli v6 - Relocation Problem > Frans van Daalen wrote: >> If you want me to >> check it in detail just let me know and I will do so for you. > > Thanks, could you please check my small changes below? Try with both > HTTP 1.0/1.1, with as well as w/o property Connection set to 'Keep-Alive'/ > 'Close'. > It's working here using GET, only I'm not sure whether it might have some > other side effects, RequestDone is not triggered on each relocation. > Problem URL: http://feeds.feedburner.com/foxsports/RSS/headlines?m=4765 > leads to three relocations, first goes to a different host. > > > 1 - procedure THttpCli.GetHeaderLineNext > > [..] > { FContentLength = -1 when server doesn't send a value } >if ((FContentLength = -1) and { Added 12/03/2004 } >((FStatusCode < 200) or{ Added 12/03/2004 } > (FStatusCode = 204) or{ Added 12/03/2004 } > (FStatusCode = 301) or{ Added 06/10/2004 } > (FStatusCode = 302) or{ Added 06/10/2004 } > (FStatusCode = 304) or{ Added 12/03/2004 } > (FStatusCode = 401) or{ Added 12/28/2005 } //AG > 12/28/05 > (FStatusCode = 407))) { Added 12/28/2005 } //AG > 12/28/05 > or >(FContentLength = 0) > or >(FRequestType = httpHEAD) then begin >{ TriggerHeaderEnd; }{ Removed 10/01/2004 } >if {(FResponseVer = '1.0') or (FRequestVer = '1.0') or} > { [rawbite 31.08.2004 Connection controll] } >FCloseReq then begin >if FLocationFlag then { Added 16/02/2004 } >StartRelocation{ Added 16/02/2004 } >else begin { Added 16/02/2004 } >if FRequestType = httpHEAD then begin { Added > 23/07/04 } >{ With HEAD command, we don't expect a > document } >{ but some server send one > } >FReceiveLen := 0; { Cancel received > ta } >StateChange(httpWaitingBody); >FNext := nil; >end; >FCtrlSocket.CloseDelayed; { Added 10/01/2004 } >end; >end > => else begin // not FCloseReq > => if FLocationFlag then > => StartRelocation >else >SetReady; > => end; >Exit; >end; > [..] > > > 2 - Not so important, but LocationChangeCurCount has been counted > incorrectly. > procedure THttpCli.StartRelocation > [..] >FRcvdCount:= 0; >FReceiveLen := 0; >FHeaderLineCount := 0; >FBodyLineCount:= 0; > >if {(FResponseVer = '1.1') and} >{ [rawbite 31.08.2004 Connection controll] } > (FCurrentHost = FHostName) and > (FCurrentPort = FPort) and > (FCurrentProtocol = FProtocol) and > (not FCloseReq) then begin { SAE 01/06/04 } > >{ This block moved 03/07/2006 } > => { V1.90 25 Nov 2005 - restrict number of relocations to avoid > continuous loops } >inc (FLocationChangeCurCount) ; >if FLocationChangeCurCount > FLocationChangeMaxCount then begin >AllowMoreRelocations := false; >if Assigned (FOnLocationChangeExceeded) then >FOnLocationChangeExceeded(Self, FLocationChangeCurCount, > AllowMoreRelocations); >if not AllowMoreRelocations then begin >SetReady; >exit; >end; > => end; > >{ No need to disconnect } >{ Trigger the location changed event 27/04/2003 } > [..] > > > --- > Arno Garrels [TeamICS] > http://www.overbyte.be/eng/overbyte/teamics.html > > > Frans van Daalen wrote: >> - Original Message - >> From: "Arno Garrels" <[EMAIL PROTECTED]> >> ..> >>> Since I've never been using THttpCli in one of my applications I'm >>> not very familiar with HTTP as well as the THttpCli. That's why I >>> wonder whether it is intented to trigger RequestDone on each >>> relocation or not (sometimes it's triggered in V5, V6 sometimesnot), >>> probably someone more familiar with the component can clear me up? >>> With two simple changes I can make the Fol
Re: [twsocket] How can we automatically set timeout in FTP
Hello, In fact, I must send files and then receive files. But I must send and receive theses files in respecting their creating/modificating date. And for example, if a file is not received correctly, I must stop the connection. I need to do these transfers step by step and stop it in case of problem. I cant download or upload several files in same times; thats why Im using synchronous methods and not asynchronous. And for the timeout, if I asked if there is a method to know the connection type or connection speed, its because users can use this system with high speed connection or very low speed connection. My English is not very good so I hope that Im clear ! Hello Arnold, > But in my test, I'm used Put method, not putAsync method. Please try the async methods, it is more encouraged :) Arnold Fluteaux Chargé d'Affaires SCJ Informatique 02.35.59.22.55 06.15.77.70.14 -- 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
Re: [twsocket] How can we automatically set timeout in FTP
Hello Arnold, > But in my test, I'm used Put method, not putAsync method. Please try the async methods, it is more encouraged :) --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz -- 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
Re: [twsocket] How can we automatically set timeout in FTP
Arnold FLUTEAUX wrote: > Thanks. > When I've modified the ftpclient.timeout from 15 to 60, theses > disconnections had disappeared. 15 is far too short, why don't you make it an user option? > So I thought that this property was > important because it's used in "WaitUntilReady" function. Yes it is. But increasing component's Timeout won't change anything in case you hit a winsock timeout/error. The error message you posted is a winsock error. When the component timeout triggers current, synchronous method returns False with StatusCode 426 as well as ErrorMessage "426 Timeout", see function TFtpClient.WaitUntilReady in (OverbyteIcs)FtpCli.pas. > And > according to me, I wanted to set automatically this property with the > speed of connections. 15 seconds is OK for high but not for a mobile > connections at 9.6. I would set it to 30 sec by default and would provide an option somewhere in the settings. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html > Arnold > > > Arnold FLUTEAUX wrote: >> I've question on the timeout. >> >> With a high speed connection, the timeout is equal to 15 seconds. But >> with a very low connection (9,6 kbits/s) , they are several problems >> and the ftp disconnect itself with the message "500 Connection closed >> time out (winsock error #100060)". >> So to avoid this problem, I have >> increased the timeout to 60 seconds. > > Those kind of errors are caused by a winsock timeout. I think it > should be possible to set that value somewhere in the registry, have > you? Property TFtpCli.Timeout effects only in case you would use the > sync methods, and it triggers independent of the winsock timeout, > however the shorter timeout would trigger first. > >> >> So is it the good solution ? And if it's OK, how can set the timeout >> automatically ? > > If you mean the system-wide winsock timeout, I don't think it is a > good idea to change that automatically on system you do not own. > > --- > Arno Garrels [TeamICS] > http://www.overbyte.be/eng/overbyte/teamics.html > > >> >> Thanks >> >> Arnold -- 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
Re: [twsocket] How can we automatically set timeout in FTP
>Property TFtpCli.Timeout effects only in case you would use the sync methods, and it triggers independent of the winsock timeout, however the shorter timeout would trigger first. But in my test, I'm used Put method, not putAsync method. Arnold Message: 2 Date: Tue, 4 Jul 2006 10:42:09 +0200 From: "Arnold FLUTEAUX" <[EMAIL PROTECTED]> Subject: [twsocket] How can we automatically set timeout in FTP To: Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="us-ascii" Hello, I'm french. I'm using a FTP developing with ICS FTP client. It's really good ! I've question on the timeout. With a high speed connection, the timeout is equal to 15 seconds. But with a very low connection (9,6 kbits/s) , they are several problems and the ftp disconnect itself with the message "500 Connection closed time out (winsock error #100060)". So to avoid this problem, I have increased the timeout to 60 seconds. So is it the good solution ? And if it's OK, how can set the timeout automatically ? Thanks Arnold -- Message: 3 Date: Tue, 4 Jul 2006 12:18:47 +0200 From: "Arno Garrels" <[EMAIL PROTECTED]> Subject: Re: [twsocket] How can we automatically set timeout in FTP To: "ICS support mailing" Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset="iso-8859-1" Arnold FLUTEAUX wrote: > I've question on the timeout. > > With a high speed connection, the timeout is equal to 15 seconds. But > with a very low connection (9,6 kbits/s) , they are several problems > and the ftp disconnect itself with the message "500 Connection closed > time out (winsock error #100060)". > So to avoid this problem, I have > increased the timeout to 60 seconds. Those kind of errors are caused by a winsock timeout. I think it should be possible to set that value somewhere in the registry, have you? Property TFtpCli.Timeout effects only in case you would use the sync methods, and it triggers independent of the winsock timeout, however the shorter timeout would trigger first. > > So is it the good solution ? And if it's OK, how can set the timeout > automatically ? If you mean the system-wide winsock timeout, I don't think it is a good idea to change that automatically on system you do not own. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html > > Thanks > > Arnold -- Message: 4 Date: Tue, 4 Jul 2006 08:44:01 -0300 From: ?ric Fleming Bonilha <[EMAIL PROTECTED]> Subject: Re: [twsocket] UDP Concept doubt To: "ICS support mailing" Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Thanks Dan!!! Now I got it Thanks!!! -- 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
Re: [twsocket] How can we automatically set timeout in FTP
Thanks. When I've modified the ftpclient.timeout from 15 to 60, theses disconnections had disappeared. So I thought that this property was important because it's used in "WaitUntilReady" function. And according to me, I wanted to set automatically this property with the speed of connections. 15 seconds is OK for high but not for a mobile connections at 9.6. Arnold Arnold FLUTEAUX wrote: > I've question on the timeout. > > With a high speed connection, the timeout is equal to 15 seconds. But > with a very low connection (9,6 kbits/s) , they are several problems > and the ftp disconnect itself with the message "500 Connection closed > time out (winsock error #100060)". > So to avoid this problem, I have > increased the timeout to 60 seconds. Those kind of errors are caused by a winsock timeout. I think it should be possible to set that value somewhere in the registry, have you? Property TFtpCli.Timeout effects only in case you would use the sync methods, and it triggers independent of the winsock timeout, however the shorter timeout would trigger first. > > So is it the good solution ? And if it's OK, how can set the timeout > automatically ? If you mean the system-wide winsock timeout, I don't think it is a good idea to change that automatically on system you do not own. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html > > Thanks > > Arnold -- 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
Re: [twsocket] UDP Concept doubt
Thanks Dan!!! Now I got it Thanks!!! - Original Message - From: "Dan" <[EMAIL PROTECTED]> To: "'ICS support mailing'" Sent: Monday, July 03, 2006 7:11 PM Subject: Re: [twsocket] UDP Concept doubt UDP packets can be fragmented at the IP level, but once you do a receive you will receive the full datagram so you don't have to worry about it. A problem you may run into though is that of WSockets default buffer not being big enough for a full size UDP packet... you might have to set the buffer higher than the default if you aren't receiving the full datagrams. Dan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Éric Fleming Bonilha Sent: 03 July 2006 13:42 To: twsocket@elists.org Subject: [twsocket] UDP Concept doubt Hello Everyone! I´m in doubt in some aspects of UDP. Do UDP suffers from fragmentation like TCP? what I mean is that in TCP if I send a chunck of data, it is not guaranteed that this data will be received in a single event correct? It is guaranteed that it will be delivered completed and in order, so we have to implement packet boundaries on the application protocol. I would like to know if I send packets of data in UDP it will be fragmented too, because if it is, than an application protocol that will use UDP as underling layer will have to implement some packet boundaries mechanism. I´m asking this because of the RTP (Real Time Protocol) protocol, I´m currently developing an application that will have to parse RTP packets, but on RTP specification there is no packet boundaries. On the specification is only said that one RTP packet should be sent on one UDP packet, but I´m thinking if UDP packet will be fragmented and will be received in one or more events on ICS Thanks a lot Éric Fleming Bonilha -- 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 -- 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 -- 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
Re: [twsocket] How can we automatically set timeout in FTP
Arnold FLUTEAUX wrote: > I've question on the timeout. > > With a high speed connection, the timeout is equal to 15 seconds. But > with a very low connection (9,6 kbits/s) , they are several problems > and the ftp disconnect itself with the message "500 Connection closed > time out (winsock error #100060)". > So to avoid this problem, I have > increased the timeout to 60 seconds. Those kind of errors are caused by a winsock timeout. I think it should be possible to set that value somewhere in the registry, have you? Property TFtpCli.Timeout effects only in case you would use the sync methods, and it triggers independent of the winsock timeout, however the shorter timeout would trigger first. > > So is it the good solution ? And if it's OK, how can set the timeout > automatically ? If you mean the system-wide winsock timeout, I don't think it is a good idea to change that automatically on system you do not own. --- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html > > Thanks > > Arnold -- 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
[twsocket] How can we automatically set timeout in FTP
Hello, I'm french. I'm using a FTP developing with ICS FTP client. It's really good ! I've question on the timeout. With a high speed connection, the timeout is equal to 15 seconds. But with a very low connection (9,6 kbits/s) , they are several problems and the ftp disconnect itself with the message "500 Connection closed time out (winsock error #100060)". So to avoid this problem, I have increased the timeout to 60 seconds. So is it the good solution ? And if it's OK, how can set the timeout automatically ? Thanks Arnold -- 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