[Cuis-dev] starting, stopping, and restarting WebServer
Mariano Montone
marianomontone at gmail.com
Wed Sep 25 05:55:12 PDT 2024
No. I discovered how to do it. Call #listeOn: after #destroy:
"1) Create server"
server := WebServer new.
server addService: '/' action: [:req | req send200Response: 'Hello,
World!'].
server listenOn: 3050.
"2) Destroy the server"
server destroy.
"3) Restart the server"
server listenOn: 3050
El 25/9/24 a las 09:44, Mariano Montone escribió:
>
> What works for me is to detroy and then create the webserver instance
> again:
>
> "1) Create server (again)"
> server := WebServer new.
> server addService: '/' action: [:req | req send200Response: 'Hello,
> World!'].
> server listenOn: 3050.
>
> "2) Destroy the server"
> server destroy.
>
>
> Evaluate 1), then 2), then 1) again. I would be nice if there were a
> better way, but at least that's better than restarting the image.
>
>
> Mariano
>
> El 24/9/24 a las 14:53, Mark Volkmann via Cuis-dev escribió:
>> Here is a very simple use of the WebServer class that can be
>> installed with
>> Feature require: 'WebClient'. A fileOut containing this code is attached.
>> The class name is BasicWebServer and it has the single instance
>> variable server.
>> It contains only these instance methods.
>>
>> initialize
>> server := WebServer new.
>> server addService: '/' action: [:req | req send200Response:
>> 'Hello, World!'].
>>
>> start
>> server listenOn: 3000
>>
>> stop
>> server stopListener
>>
>> I can start the web server with:
>>
>> server := BasicWebServer new.
>> server start.
>>
>> Then I can browse localhost:3000 and see "Hello, World!" in the web
>> browser.
>>
>> I can stop the web server with:
>>
>> server stop.
>>
>> But I cannot start it again unless I restart the VM. Can someone
>> please explain what else I can do to enable restarting the server
>> without needing to restart the VM?
>>
>> --
>> R. Mark Volkmann
>> Object Computing, Inc.
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240925/c0fe20df/attachment.htm>
More information about the Cuis-dev
mailing list