How to mimic telnet session

Jan Schenkel janschenkel at yahoo.com
Mon Dec 29 18:20:07 EST 2003


--- Dar Scott <dsc at swcp.com> wrote:
> 
> On Monday, December 29, 2003, at 04:00 PM, Jan
> Schenkel wrote:
> 
> > on DataSent pSocket
> >   read from socket pSocket until empty \
> >        with message "DataRead"
> > end DataSent
> 
> Hi, Jan!
> 
> Won't this need 'until numToChar(13)' or some
> mechanism to collect 
> bytes until all are in such as repeaded reads?
> 
> Dar Scott
> 

Hi Dar,

Quite possibly -- I didn't actually test the above
code and it could be dependent on the speed of the
connection. If you're sure you'll get a linefeed at
the end of the reply, it's better to wait for that to
drop by :-)
So a better version of the handler 'DataSent' is :
--
on DataSent pSocket
  read from socket pSocket until numToChar(13) \
       with message "DataRead"
end DataSent
--

Tested and it works -- thanks for the reminder,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


More information about the use-livecode mailing list