<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>What works for me is to detroy and then create the webserver
instance again:</p>
<p>"1) Create server (again)"<br>
server := WebServer new.<br>
server addService: '/' action: [:req | req send200Response:
'Hello, World!'].<br>
server listenOn: 3050.<br>
<br>
"2) Destroy the server"<br>
server destroy.</p>
<p><br>
</p>
<p>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.</p>
<p><br>
</p>
<p> Mariano<br>
</p>
<div class="moz-cite-prefix">El 24/9/24 a las 14:53, Mark Volkmann
via Cuis-dev escribió:<br>
</div>
<blockquote type="cite"
cite="mid:CAFfRWnWye9amGGqSXx42QH-5Rh6M4W0BNOubawJ50P0Ti_WHRA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Here is a very simple use of the <font
face="monospace">WebServer</font> class that can be installed
with
<div><font face="monospace">Feature require: 'WebClient'</font>.
A fileOut containing this code is attached.</div>
<div>The class name is <font face="monospace">BasicWebServer</font>
and it has the single instance variable <font
face="monospace">server</font>.</div>
<div>It contains only these instance methods.</div>
<div><br>
</div>
<div><font face="monospace">initialize <br>
server := WebServer new.<br>
server addService: '/' action: [:req | req
send200Response: 'Hello, World!'].</font></div>
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace">start<br>
server listenOn: 3000<br clear="all">
</font>
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace">stop<br>
server stopListener</font><br>
</div>
<div><br>
</div>
<div>I can start the web server with:</div>
<div><br>
</div>
<div><font face="monospace">server := BasicWebServer new.</font></div>
<div><font face="monospace">server start.</font></div>
<div><br>
</div>
<div>Then I can browse localhost:3000 and see "Hello, World!"
in the web browser.</div>
<div><br>
</div>
<div>I can stop the web server with:</div>
<div><br>
</div>
<div><font face="monospace">server stop.</font></div>
<div><br>
</div>
<div>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?</div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div><font face="arial, helvetica, sans-serif">R.
Mark Volkmann</font></div>
<div><span style="font-size:12.8000001907349px"><font
face="arial, helvetica, sans-serif">Object
Computing, Inc.</font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
</blockquote>
</body>
</html>