I don't want "read from socket" to be blocking
    Björnke von Gierke 
    bvg at mac.com
       
    Thu Jul 31 18:03:00 EDT 2003
    
    
  
I use read socket to access a pop3 server (email) I need to repeat 
certain commands several times. How can I make them non-blocking while 
still repeating them? I just don't get it :(
Script sample with two different repeat forms below:
on handler theID theData
   repeat with x = 1 to (the second word of theData) --number of messages
     write ( "TOP" && x && "0" & crlf  ) to socket server & ":110" --TOP 
0 =get only headers
     read from socket server & ":110" until crlf & "." & crlf --should 
be non-blocking but isn't
     if theMessage contains "Reply-To: use-revolution at lists.runrev.com" 
then
       put x & "," after theList --gather all runrev messages
     end if
   end repeat
   repeat for each item theItem in theList --all messages from runrev
     write ( "UIDL" && theItem & crlf  ) to socket server & ":110" --get 
hash of message
     read from socket server & ":110" until crlf
     put word 2 to -1 of it into theHash
     if thehash is not among the items of the hashList of this stack 
then --not previously downloaded
       write ( "RETR" && theItem & crlf  ) to socket server & ":110" 
--get the whole message
       read from socket server & ":110" until crlf & "." & crlf with 
message "retrieved" -- does this work?
     end if
   end repeat
end handler
    
    
More information about the use-livecode
mailing list