World: r3wp
[!REBOL3 Schemes] Implementors guide
older newer | first last |
Steeve 8-Jan-2010 [455x2] | exactly |
the weird thing is that you need to perform 2 OPEN when the ip need a translation. A little disturbing... | |
Graham 8-Jan-2010 [457] | Is that done by you or automatically ? |
Steeve 8-Jan-2010 [458x2] | must be done by you. |
see in the example: lookup [ .... open port ] | |
Graham 8-Jan-2010 [460x2] | client: open tcp://127.0.0.1:8080 this returns a port |
structure | |
Steeve 8-Jan-2010 [462] | perhaps the second open should be done automaticly by the device after the handler processed the lookup event. Would be less disturbing |
Graham 8-Jan-2010 [463x3] | and this then opens it lookup [open event/port] |
bit confusing because of the overloading of the 'open word | |
I think I remain confused | |
Steeve 8-Jan-2010 [466] | It's clearly explain in the link you pointed. Note B OPEN is called twice. It is moded. The mode is determined by the existence of the IP address. If the IP address is not known, the LOOKUP happens, otherwise the CONNECT happens. This also means that if you do an OPEN of a port where you provide the IP address, no lookup is done; you skip directly to CONNECT. If it is necessary to determine if the IP address is known (a rare situation), use QUERY -- which can be called at any time and is very fast. |
Graham 8-Jan-2010 [467] | the lookup event though always happens ... right? |
Steeve 8-Jan-2010 [468x2] | no |
only if a dns translation is requested | |
Graham 8-Jan-2010 [470x3] | that's what I thought initially but I think that's wrong |
this is the ping client client: open tcp://127.0.0.1:8080 client/awake: func [event] [ ;probe event/type switch event/type [ lookup [open event/port] connect [write event/port to-binary "ping!"] wrote [ print "Client sent ping to server" read event/port ] read [ print ["Server said:" to-string event/port/data] if (++ ping-count) > 50 [return true] clear event/port/data write event/port to-binary "ping!" ] ] false ] | |
I haven't tried it .. though to see if the lookup occurs | |
Steeve 8-Jan-2010 [473] | in this example, the lookup event is not fired. So it''s a bad example |
Graham 8-Jan-2010 [474] | in that case the docs need to be fixed! |
Steeve 8-Jan-2010 [475] | yes probably |
Graham 8-Jan-2010 [476] | I just ran the code .. the lookup does occur in the client |
Steeve 8-Jan-2010 [477] | well well, let me try it again |
Graham 8-Jan-2010 [478x2] | so, I think it is what I said .. the lookup event always happens .. and it is triggered by the obtaining of the ip address. It is the lookup itself that need not occur. |
and that happens in the tcp device | |
Steeve 8-Jan-2010 [480x3] | ok i see what is the problem. |
at the start, replace: >> client: open tcp://127.0.0.1:8080 by >> client: open [scheme: 'tcp host: 127.0.0.1 port-id: 8080] You will see that the lookup event is not fired, then i'll explain why | |
or maybe you'll figure it | |
Graham 8-Jan-2010 [483x4] | true .. not fired |
give up ... | |
In my own code I see two lookup events one after the other ... | |
so if I put an 'open in the lookup event, I open the port twice | |
Steeve 8-Jan-2010 [487] | brb |
Graham 8-Jan-2010 [488x3] | Does parse skip spaces automatically in r3 ? |
parse "OK OK" [ "OK" "OK" ] is false in R3 | |
seems not ... parse "a b c" [ "a" "b" "c" ] => false | |
Kaj 8-Jan-2010 [491] | I think that was changed from R2 |
Graham 8-Jan-2010 [492x2] | Looks like it ... no mention so far that I can see of this new behaviour |
Looks like the learning curve is going to be steeper than I thought | |
Kaj 8-Jan-2010 [494x2] | It was discussed maybe half a year ago. Don't remember where; there are so many possible places |
Or probably more recently during the parse project | |
Graham 8-Jan-2010 [496x3] | Ok, I wasn't paying attention ... |
what's the equivalent of set-net ? | |
ie. where is the smtp mail server information stored and where is the email stored? | |
Kaj 8-Jan-2010 [499] | There's no SMTP, so no need for set-net yet |
Graham 8-Jan-2010 [500x5] | there's no system user object |
Ok, this is pretty buggy and doesn't seem to send a well formed email ... not sure why http://rebol.wik.is/Rebol3/Schemes/Smtp | |
Anyway I've posted it for discussion, and to allow the rebol optimizer have a look .... | |
There are quite a few issues with it. | |
As soon as I connect the server sends me a "220" I can only get that by sending the EHLO. Which triggers me to send another EHLO :( | |
older newer | first last |