Hi Lutz,
I seem to be unable to get my network functions work together with guiserver.
I use net-peek and/or net-select but its or the guiserver or the network
that is working, but never both...
My program is unable to and do copy from text area's
and listen handle network data... I expected this though but i did not expect
that i could not fix it.. :-)
Do i need to create my own gs:listen to get blocking network events working
together with guiserver?
PS: perhpas gs:listen could get a net-select inside its function?
so that other actions from the script can continue?
Norman.
Guiserver none-blocking question
Guiserver none-blocking question
-- (define? (Cornflakes))
it depends on the circumstances. For closed transactions like http requests which are initiated and finished in an action handler, there should not be a problem, but if you have your own blocking net work stuff going then yes you have to prep up the gs:net-listen function.Do i need to create my own gs:listen to get blocking network events working together with guiserver?
Look at the definition of it inside guiserver.lsp inside the gs context:
Code: Select all
(define (listen flag)
(while (net-receive in 'event 100240 "\n")
(eval-string event))
(println "server shut down")
(if (not flag) (exit))
)
Note that the (eval-string event) has to happen inside the gs context. When you run your own loop perhaps you define inside gs:
Code: Select all
(define (eval-event str)
(eval-string str))
Code: Select all
(while listening
(if (net-select gs:in "read" 10000)
(begin
(net-receive gs:in 'event 100240 "\n")
(eval-event event)
)
)
(if (net-select myport "read" 10000)
(do-my-thing))
)
Code: Select all
(while my-loop-is-running
(gs:check-for-events)
(if (net-select myport "read" 10000)
(do-my-thing))
)
I am open to suggestions ...
Lutz
Yes oke..thanks...
I think we need indeed a kind of "insert" mechanism towards the gs:listen function.. to work around this...
perhpas gs:listen could accept a list which contains all functions that
should be used given with gs:listen... else return 'nil...
(gs:listen '( (function-one-blocking timeout) (function-two-blocking timeout) ) true|none )
Then put them all inside a net-select with the specific timeout defined..
I need to think this over ;-)
I think we need indeed a kind of "insert" mechanism towards the gs:listen function.. to work around this...
perhpas gs:listen could accept a list which contains all functions that
should be used given with gs:listen... else return 'nil...
(gs:listen '( (function-one-blocking timeout) (function-two-blocking timeout) ) true|none )
Then put them all inside a net-select with the specific timeout defined..
I need to think this over ;-)
-- (define? (Cornflakes))