GUI server restart after closing

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE
Locked
HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

GUI server restart after closing

Post by HPW »

I tried GUI-Server 0.3 from newLISP.dll and set:

(gs:listen true)

So my app keep open onClose.
I was not able to restart the GUI after the first close.

What is the correct way to close and to restart the GUI ?
Is it possible to use it that way?
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Normally the gs:listen loop will exit when communication with guiserver.jar is interrupted. The 'true flag keeps newlisp running (or in your case newlisp.dll).

But you should still be able to close the gui part (i.e. by clicking on the x icon)
I was not able to restart the GUI after the first close.
Was Java still running in Windows task manager?

Or did the network routines fail when trying to connect the second time?

Perhaps the port newlisp.dll was using have to be closed. Change the gs:listen routine in guiserver.lsp to the following:

Code: Select all

(define (listen flag)
    (while (net-receive in 'event 100240 "\n")
        (eval-string event))
    (println "server shut down")
    (if (not flag) (exit))
    (net-close listenSock)
)
If this works for dll mode let me know and I can add it.

Lutz

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Was Java still running in Windows task manager?
No, it disappears.
Or did the network routines fail when trying to connect the second time?
Seems so.
First time it shows:

Code: Select all

server listening on 47011
server accepted from 0.0.0.0
server connecting to 0.0.0.0:47012
server connected
Second time only:

Code: Select all

server listening on 47011
and hanging.
Java reloads to around 15 MB instead of 23 MB the first time.
Not returning from: (load "c:/Programme/newlisp/widgets-demo.lsp")
Perhaps the port newlisp.dll was using have to be closed. Change the gs:listen routine in guiserver.lsp to the following:
Did not solve this problem.
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

when you run a GUI app from newlis.dll how do you start it the 1st and the 2nd time? I guess you are using NeoBook to import newlisp.dll?

It looks like the newlisp.ddl doesn't try to do the net-connect the second time or fails on it for some reason.

This is not easy to debug and I will not get to this until later, completing the 2D functionality and making sure things work when invoked from the normal newlisp executable first. Perhaps you can find a workaround, unloading newlisp.dll and then loading it again?

Lutz

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Turns out there is a simple solution. Make the following change in 'gs:init' in guiserver.lsp:

Code: Select all

    ...
    (set 'retry 0)
    (set 'out nil)   ; <=== add this statement
    (while (not out)
    ...
now you shoud be able to so multiple restarts from the DLL. This will be included in future versions of guiserver.lsp. You still have to put the optional 'true in (gs:listen true)

Lutz

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

Thanks Lutz,

works as expected now!

;-)
Hans-Peter

Locked