Telnet and eMail

Dar Scott dsc at swcp.com
Thu Jul 24 17:07:01 EDT 2003


On Thursday, July 24, 2003, at 02:39 PM, Ludovic Thébault wrote:

> on mouseup
>   open socket to pop.myhost:110
>   read from socket pop.myhost:110 with message "itswork" -- ok, it's
> work
>   write "USER"&&mylogin & cr to socket pop.myhost:110 with message
> "itsdone"
> write "PASS"&&myPass & cr to socket pop.myhost:110 with message
> "itsdone"
> write "LIST" & cr to socket pop.myhost:110 with message "itsdone"
> end mouseup
>
> on itswork socketID, theMsg
> put theMsg into fld "Messages"
> end itswork
>
> on itsdone socketID
> put cr & socketID after fld "Messages"
> end itsdone
>
> - how to display messages (like "+OK password required") send by the
> host in a field ? The callbackmessage display only the socket host.

First...
You are mixing two styles, using messages (non-blocking) and without  
(blocking).

Try it first without.

A mouseUp handler not using messages may take a short but noticeable  
time and other things won't work during the transaction, so I'd set the  
cursor to a watch while experimenting.

In reading without messages, read until the last character of your  
end-of-line characters.  The result will be in 'it'.  Remove the  
end-of-line character or characters or replace them with readable names  
for debugging.

Second...
Take care with your end of line.  I don't have POP3 in front of me, but  
I expect it might be ASCII CRLF.  The many names for the Revolution  
new-line or end-of-line all are coded numToChar(10).  Your end-of-line  
for POP3 is probably not and may be two characters.  Handle this  
carefully in both sending and receiving.  If you need more help here,  
just ask.

Third...
Check for success with result().  While learning how Revolution does  
tcp/ip, you might want to print it out after each operation.  Print out  
the sysError(), too; it can be handy when reporting results to the list  
when asking questions.

After you get that going, then move on to using messages.  Ask about  
that, if you need.  I use sockets messages with send to handle read and  
write.

I hope this gets you going in the right direction.

Dar Scott

************************************************************************ 
****
   Dar Scott Consulting    http://www.swcp.com/dsc/    Programming  
Services
************************************************************************ 
****



More information about the use-livecode mailing list