Re: Determining TCP stream end
Re: Determining TCP stream end
- Subject: Re: Determining TCP stream end
- From: Peter Lovell <email@hidden>
- Date: Wed, 13 Feb 2002 10:03:12 -0500
>
Hello,
>
>
I'm programming FTP app using OT. I'm using synchronous non-blocking
>
model with threads and I have this problem:
>
>
Server sends me some TCP data stream. So I count the incoming data
>
by OTCountDataBytes and mark that I have to read XYZ bytes from that
>
endpoint. OK, then I issue OTRcv and if T_MORE flag is present, I
>
invoke my notifier with another T_DATA event and I'm doing the same,
>
but:
>
>
How do I tell that I've read all the data? i.e. the FTP welcome
>
message is complete and I should issue USER command? I know I can
>
issue it immediately, but if there were some data I need to know
>
about, I cannot tell if I'm finished or not. I can use timeout of say
>
5 secs, but this is highly ineffective. Do I have to wait until
>
T_MORE flag clear and then consider it read?
>
>
The same approach appears after connect. If I do connect I have to
>
wait some time, probably up to some timeout to receive incoming data.
>
>
Also one more thing. If I don't issue WaitNextEvent from a separate
>
thread I get no more date. As far as I know this is to let OT process
>
data so EventAvail/SystemTask would be enough, but it is not. Did I
>
miss something?
>
Responses from FTP server are telnet lines, terminated with <CR> <LF>
sequence. Last line of a response will begin with <digit> <digit> <digit>
<space>, while intermediate lines (i.e. more lines to follow) start with
<digit> <digit> <digit> <hyphen>
So the line you want will start with "220 " and finish with <CR><LF>
Check rfc 959 for the main details.
Regards.....Peter
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.