From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c58b7bd180ea81b2 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!aioe.org!not-for-mail From: Dennis Hoppe Newsgroups: comp.lang.ada Subject: Re: Problems with Ada.Streams.Read (blocking) Date: Fri, 08 Aug 2008 21:37:45 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <1c7gwe0hi3ew5$.1c9zms1qkzjel.dlg@40tude.net> <150pczbbk7gb2$.1ashrop4xh1b.dlg@40tude.net> NNTP-Posting-Host: U0vjPcDXCVFh7Khkeo3Jnw.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) Xref: g2news1.google.com comp.lang.ada:1565 Date: 2008-08-08T21:37:45+02:00 List-Id: Dmitry A. Kazakov wrote: > You never reach the end of a TCP/IP stream unless the client closes the > socket, which is usually indicates an error. > > The point is that you should never care about the stream end. Seems, that I am not as familiar with streams as I should ;) > You have mentioned FTP. There is a clear definition of how a FTP server > response ends: > > "The client can identify the last line of the response as follows: it > begins with three ASCII digits and a space; previous lines do not. The > three digits form a code. Codes between 100 and 199 indicate marks; codes > between 200 and 399 indicate acceptance; codes between 400 and 599 indicate > rejection." > -- http://cr.yp.to/ftp/request.html > > If you correctly implement the protocol your application will never block > unless the server is not busy. And you have to read out all response > otherwise the server will be block. So both parties know the states of each > other. Yeah, I am used to the status codes, but I am struggeling with the welcome message from ftp servers :-) FileZilla send three or four lines of information, all with status code 220. By means of your weblink (cr.yp.to - hehe), I saw the following: 150-This is the first line of a mark 123-This line does not end the mark; note the hyphen 150 This line ends the mark 226-This is the first line of the second response 226 This line does not end the response; note the leading space 226 This is the last line of the response, using code 226 This solves already the problem, because indeed the series of consecutive commands is finished, if three digits were followed by a blank. Each line of the welcome message begins with 220- and only the last one with 220_ (blank). Ok, I will never have a blocking read call in the future ;-) Thank you very much, you made my day! Best regards, Dennis