Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

differences between script output and typing with tcp port

 [1/6] from: sags:apollo:lv at: 4-Apr-2004 23:34


newbie q: why there is differencies f.ex. script: [ REBOL [Title: "CGI Test Script"] print "Content-Type: text/plain" print "" ; required print "<html>" print "<head>" print "<title>Rebol script test</title>" print "</head>" print "<body>" print "<h1>Hello!</h1>" checkPop: func [user-name passe pop-server port- number] [ myCommands: ["user admin" "pass qwerty" "list"] myPop: open/lines/no-wait [ scheme: 'tcp host: pop-server port-id: port-number ] wait myPop response: copy myPop probe response print "<br>" foreach myCom myCommands [ print join "<br>>" myCom print "<br>" insert myPop myCom wait myPop response: copy myPop probe response ] ; print "<pre>" print "</table>" print "<pre>quit" insert myPop "quit" wait myPop probe copy myPop print "</pre>" close myPop ] checkPop "admin" "qwerty" "localhost" 110 print "</body>" print "</html>" ] Produces following output with do: Content-Type: text/plain <html> <head> <title>Rebol script test</title> </head> <body> <h1>Hello!</h1> [{+OK Hamster-POP3, Hamster-Classic Vr. 1.3 (Build 1.3.21.0) <[c4q53k--3vs4i15--1--FQDN-n] ot-set.he374c91d.invalid>}] <br> <br>>user admin <br> ["+OK More authentication information required"] <br>>pass qwerty <br> ["+OK mailbox locked, 3 messages"] <br>>list <br> ["+OK 3 messages"] </table> <pre>quit ["1 411" "2 405" "3 405" "." "+OK closing connection - goodbye!"] </pre> </body> </html> After command quit I am getting just part of response while when I am doing the same by typing in console I am geting full response after comand, that gives multiline response:
>> myPop: open/lines/no-wait tcp://localhost:110 >> a: copy myPop
== [{+OK Hamster-POP3, Hamster-Classic Vr. 1.3 (Build 1.3.21.0) <[c4q4a3--3vs4i15--1--FQD] N-not-set.hf8a3c319.invalid>}]
>> probe a
[{+OK Hamster-POP3, Hamster-Classic Vr. 1.3 (Build 1.3.21.0) <[c4q4a3--3vs4i15--1--FQDN-n] ot-set.hf8a3c319.invalid>}] == [{+OK Hamster-POP3, Hamster-Classic Vr. 1.3 (Build 1.3.21.0) <[c4q4a3--3vs4i15--1--FQD] N-not-set.hf8a3c319.invalid>}]
>> insert myPop "user admin" >> a: copy myPop
== ["+OK More authentication information required"]
>> insert myPop "pass qwerty" >> a: copy myPop
== ["+OK mailbox locked, 3 messages"]
>> insert myPop "list" >> a: copy myPop
== ["+OK 3 messages" "1 411" "2 405" "3 405" "."]
>> insert myPop "quit" >> close myPop >>
Interesting also is that throught cgi the last response differs from that I got from running that script in console: <pre>quit ["1 411" "2 405" "3 405" "."] </pre> </body> </html> Thanks in advance, Janeks

 [2/6] from: antonr:lexicon at: 5-Apr-2004 23:06


I think don't use /no-wait. (You also might not need to use wait myPop, then ...) Just a quick suggestion. The difference between console typing session and script is: the script doesn't pause in between... Anton.

 [3/6] from: sags:apollo:lv at: 5-Apr-2004 22:28


I experimented with wait / nowait - it is not a reason. It seems for me that reason is platform dependent or mail server dependent. The example I decribed in previous mesage I got on an very old PC with Win95 4.00.950 B (processor 175 mhz) ;-) with MSIE 4.0 and freeware servers: web - Abyss and mail - Hamster. Finaly I tested that script on brand new PC with Win2000pro and ISP mail server - all was running well - as I expected. At last I tested it on that old PC with my ISP mailserver and I got many blue screens, and finaly result that was the same like on the new PC. But after a few keypreses Win95 finaly dies. It looks like that I shoul upgrade my study PC to continue time effective Rebol studies. :-| Janeks On 5 Apr 2004 at 23:06, Anton Rolls wrote: I think don't use /no-wait. (You also might not need to use wait myPop, then ...) Just a quick suggestion. The difference between console typing session and script is: the script doesn't pause in between... Anton.
> newbie q: > why there is differencies
<<quoted lines omitted: 107>>
> Thanks in advance, > Janeks
-- To unsubscribe from this list, just send an email to [rebol-request--rebol--com] with unsubscribe as the subject.

 [4/6] from: SunandaDH:aol at: 5-Apr-2004 15:41


Janeks:
> It looks like that I shoul upgrade my study PC to > continue time effective Rebol studies.
Is it possible that the CGI is taking longer than a user-settable timeout under Abyss? (I've never used Abyss, but I see a similar problem with Xitami for programs that take over 1 minute to run). Sunanda.

 [5/6] from: Gary::Jones::usap::gov at: 6-Apr-2004 16:56


=== On 5 Apr 2004 at 23:06, Anton Rolls wrote: I think don't use /no-wait. (You also might not need to use wait myPop, then ...) Just a quick suggestion. The difference between console typing session and script is: the script doesn't pause in between... === From: Janeks I experimented with wait / nowait - it is not a reason. .... === Hi, Janeks, I think you may not have fully understood what Anton was suggesting. I can't speak for Anton, but I suspect that he was meaning that you may not have picked the ideal *combination* of commands for use. Rewritten in a slightly different way: *** print "Content-Type: text/plain" print "" ; required print "<html>" print "<head>" print "<title>Rebol script test</title>" print "</head>" print "<body>" print "<h1>Hello!</h1>" checkPop: func [user-name passe pop-server port-number] [ myCommands: ["user admin" "pass qwerty" "list"] myPop: open/lines [ scheme: 'tcp host: pop-server port-id: port-number ] response: pick myPop 1 probe response print "<br>" foreach myCom myCommands [ print join "<br>>" myCom print "<br>" insert myPop myCom either mycom <> "list" [ response: pick myPop 1 probe response ][ while [(response: pick mypop 1) <> "."] [probe response] ] ] print "</table>" print "<pre>quit" insert myPop "quit" probe pick myPop 1 print "</pre>" close myPop ] checkPop "admin" "qwerty" "localhost" 110 print "</body>" print "</html>" **** In this version, the tcp open command reads by line but waits for the line. The pick command picks the "first" response that comes in on the port, namely the first line. The main "problem" that comes in are the multiline responses. In this case I borrowed the technique used in the REBOL's POP scheme, namely read until an end marker is detected. I left your program in the same form so that you can compare and contrast what I think Anton meant with your own version. It is fun to play with the TCP protocols as you have. For a better understanding of master REBOL techniques, try reading through the REBOL POP scheme: probe system/schemes/pop and its companion support utilities: probe net-utils Hope that helps on ALL your platforms. --Scott Jones

 [6/6] from: sags:apollo:lv at: 7-Apr-2004 23:46


Thanks for answers! The approach to find dot in multiline responses, I found already before. That script was not so much intended to be as real script for POP operations, rather than something to start "Rebol" feeling about TCP. In this case I wanted to find out - how to detect end of response without knowing special characters. Janeks On 6 Apr 2004 at 16:56, Jones, Scott wrote:

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted