Created
March 30, 2013 00:26
-
-
Save gchiu/5274646 to your computer and use it in GitHub Desktop.
A net-utils like confirm function for R3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
confirm: func [ tcp-port [port!] challenge [string!] code [string!] | |
/local data | |
][ | |
write tcp-port challenge | |
tcp-port/awake: func [ event ][ | |
tcp-port: event/port | |
switch/default event/type [ | |
wrote [ | |
read tcp-port | |
false | |
] | |
read [ | |
data: enline to-string tcp-port/data | |
true | |
] | |
][ true ] | |
] | |
wait tcp-port | |
reduce [ find/part data length? code data ] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment