AltME: Rebol School

Messages

Gregg
I'm pretty sure I don't have it.
Maxim
I've never seen it.
PeterWood
You asked the same quesiton on 26th Jan 2012 on the REBOL3 World.
PeterWood
Endo
I nevet heard of it, but looks cool.

Reichart
Peter, yup, sometimes asking more than once gets a result, never know.
I know where I have a copy of it, but I have to dig into a safe and then pull some old drives out.

Endo
Just for the record: I've added Turkish chars support in pdf-maker.r (Gabriele's script),
I downloaded www.opensource.apple.com/source/vim/vim-44/runtime/print/cp1254.ps file and added Turkish chars from there to
/Differences [...]
If anyone need more info you can write me PM.

Arnold
Can a header be combined for a Red and a REBOL script:
Red [
REBOL[] ;] ; would this work??
Oldes
I don't think so, but this could:
REBOL [] Red [] print "hello"
(not tested)
Maxim
rebol ignores everything preceding the REBOL [  ]   for sure... in theory, Red should be doing the same thing.

Marco
Maxim
just for the record though, only one language at a time can load that script.   (you need to comment out the language you want to use )
Bo
Actually not.  This works in Rebol or Red:
RED []
rebol: none
REBOL []
print "This is a test"

Arnold
Thank you Bo! Very clever. Just to be sure use Red [] and not RED []

Reichart
What is the smallest simplest example script for "port" .  
Hopefully something that shows off how easy it is to connect two computers and send information back and forth.  Perhaps a file.  Although a message system is ok too of course.
Gregg
Something like this? Run once as server, then again as client.
role: ask "Run as [C]lient or [S]erver? "
; Server
if role = "s" [
    port: tcp://:9090
    server: open/direct/no-wait port
    wait server
    client: first server
    print "Client connected."
    forever [
        wait any [client .01]
        if msg: copy client [
            print [now/precise msg]
            insert client "pong"
        ]
    ]        
]
; Client
if role = "c" [
    port: tcp://127.0.0.1:9090
    server: open/direct/no-wait port
    forever [
        insert server "ping"
        if msg: copy server [
            print [now/precise msg]
        ]
        wait .1
    ]
]
halt
Or there are slightly more involved examples out there. Like http://www.rebol.net/cookbook/recipes/0028.html
The WAITs in mine aren't needed, just there to slow things down a bit for human consumption.
Reichart
In these examples, it is assuming a server and a client, as opposed to two clients, and then a way to get them to find each other?
Maxim
either attempt[port: open tcp://:33101] [
    print "Running as server^/----^/"
    forever [ probe copy client: first wait port   close client]
][
    print "running as client^/----^/"
    forever [ insert (server: open tcp://localhost:33101) ask "message to send: "  close server]
]
a much simpler server/client example...

Last message posted 184 weeks ago.