Console port and network ports
[1/10] from: m:koopmans2:chello:nl at: 11-Aug-2002 9:19
Hi,
Is there a way to add a network port and a console port in one wait/all
block? So I can process network events and console events, and once I
have a complete "line" from the console do something with it.
(other than using system/ports/wait-list).
And how do I capture the control characters in /Core (up tab down etc.)
--Maarten
[2/10] from: rebol:optushome:au at: 11-Aug-2002 20:35
----- Original Message -----
From: "maarten koopmans" <[m--koopmans2--chello--nl]>
To: <[rebol-list--rebol--com]>
Sent: Sunday, August 11, 2002 5:19 PM
Subject: [REBOL] Console port and network ports
> Hi,
>
> Is there a way to add a network port and a console port in one wait/all
> block? So I can process network events and console events, and once I
> have a complete "line" from the console do something with it.
>
> (other than using system/ports/wait-list).
>
> And how do I capture the control characters in /Core (up tab down etc.)
Hi Maarten,
Not sure if this helps with the second question or not..
http://www.rebolforces.com/articles/console.html
Cheers,
Allen
[3/10] from: m:koopmans2:chello:nl at: 11-Aug-2002 13:11
Thanks Allen. Let's see if I can do the trick with
system/ports/wait-list now....
--Maarten
[4/10] from: ptretter:charter at: 11-Aug-2002 6:26
Maarten:
Should can add your ports to a block. I do this often.
...
waitports: [port1 port2 port3]
forever [
if now-port = port1 [do something]
if now-port = port2 [do something else]
if now-port = port3 [print something]
now-port: wait waitports
]
Paul Tretter
[5/10] from: nitsch-lists:netcologne at: 11-Aug-2002 13:49
Am Sonntag, 11. August 2002 09:19 schrieb maarten koopmans:
> Hi,
> Is there a way to add a network port and a console port in one wait/all
<<quoted lines omitted: 3>>
> And how do I capture the control characters in /Core (up tab down etc.)
> --Maarten
Hope this helps :)
REBOL [Title: "minimuddy" Author: "Volker"
;--config
print "---" ;or crash (suse 8.0)
server-name: tcp://localhost:3333 ; homemud
;stop: does[unview/all halt]
stop: :quit
;--connecting mud
mud: open/direct/no-wait server-name
mud/awake: func [port /local new] [
either new: copy port [emit new] [stop]
false
]
append system/ports/wait-list mud
;--connecting console
;by jeff?
set 'con open/binary/direct [
scheme: 'console
awake: func [port /local c r face buf] [
buf: system/view/caret: tail enter/text
prin c: to-char first port
either find "^M^J" c [
print "" do-face ke none clear head buf
] [
;-- basic editing
either c = #"^h" [
remove back buf
] [insert buf c buf: next buf]
]
system/view/caret: buf show enter
false
]
]
append system/ports/wait-list con
;--connecting window
log: cp""
window: layout [
origin 0x0
enter: field 350x48
ke: key keycode [#"^s" #"^m"] [
send-command enter/text
system/view/caret: clear enter/text
show enter
]
below
log-face: info log 350x100 wrap
]
;--emit, send-command
set 'emit func [string /local face] [
prin string
face: log-face
append face/text string
face/para/scroll/y: negate max 0
((second size-text face) - face/size/y + 10)
show log-face
]
set 'send-command func [string] [
insert mud join string newline
emit reduce ["home>" string newline]
]
focus enter
view window
[6/10] from: g:santilli:tiscalinet:it at: 11-Aug-2002 13:53
Hi Maarten,
On Sunday, August 11, 2002, 9:19:27 AM, you wrote:
mk> Is there a way to add a network port and a console port in one wait/all
mk> block?
This works here:
wait/all [net-port console-port]
What's the problem?
mk> So I can process network events and console events, and once I
mk> have a complete "line" from the console do something with it.
If you use port/awake, remember to return FALSE when you want your
port to keep waiting, TRUE when you want WAIT to return. (I think
you know all this...)
mk> And how do I capture the control characters in /Core (up tab down etc.)
They'll come as escape sequences.
>> p: open/binary/no-wait console://
>> forever [wait p print mold copy p]
#{1B5B41} ; up
#{1B5B42} ; down
#{1B5B43} ; right
#{1B5B44} ; left
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[7/10] from: m::koopmans2::chello::nl at: 11-Aug-2002 17:20
Hi Gabriele,
> Hi Maarten,
> On Sunday, August 11, 2002, 9:19:27 AM, you wrote:
<<quoted lines omitted: 3>>
> This works here:
> wait/all [net-port console-port]
The problem is reading data from the console-port when there is an
event.
I'll have to use awake, but then I might as well use the wait-list.
I am reviving my P2P console with Rugby+ (UDP and multicast transport,
possibly TCP persistent connections as well. And interactive scripting
while network services run. And I'll add a bootstrap presence provider
service to help things getting started. You see, I'll be busy for a
while.)
Thanks anyway,
--Maarten
[8/10] from: rebolinth:nodep:dds:nl at: 12-Aug-2002 12:18
Hi Maarten,
Are you trying to redirect all Console traffic true TCP perhpas ;-) ??
I tried it, but was not successfull, somehow it also seems that the
console ports are randomly opened (and not closed afterwards under windows!!)
Anyway if you have the solution drop me a note until now i was not
100% succefull in redirecting directly Console/IO true UDP or TCP
during console access. Finaly I ended up building a new console ;-)
(R)egards,
Norman.
--- Conversation/lunch: "How do you Eat your Rebol in the Morning?"
[9/10] from: maarten:koopmans:surfnet:nl at: 12-Aug-2002 13:20
Hi Norman,
I am not trying to do that.
I want to have a console while I am in a wait event loop with a server port.
--Maarten
Norman Deppenbroek wrote:
> Hi Maarten,
> Are you trying to redirect all Console traffic true TCP perhpas ;-) ??
<<quoted lines omitted: 6>>
> Norman.
> --- Conversation/lunch: "How do you Eat your Rebol in the Morning?"
--
Maarten Koopmans
Innovation manager tel: +31 30 2 305 324
Surfnet BV fax: +31 30 2 305 329
P.O.Box 19035 email: [maarten--koopmans--surfnet--nl]
NL-3501 DA Utrecht http://www.surfnet.nl
The netherlands
[10/10] from: rebolinth:nodep:dds:nl at: 12-Aug-2002 16:08
Hi Maarten,
Right, Mmmm.. looks like Tcl/Tk uses like: wait forever (handling events)
Could not get that working under rebol eighter...
(R)egards,
Norman.
-> Hi Norman,
->
-> I am not trying to do that.
-> I want to have a console while I am in a wait event loop with a server
-> port.
->
-> --Maarten
->
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted