Hello world/Web server: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: builtins/sockets.e modified/documented, now polls for esc/Q, added output)
Line 1,441: Line 1,441:
while not find(get_key(),{ESCAPE,'q','Q'}) do
while not find(get_key(),{ESCAPE,'q','Q'}) do
{integer code} = select({sock},{},{},250000) -- (0.25s)
{integer code} = select({sock},{},{},250000) -- (0.25s)
if code=SOCKET_ERROR then crash("select") end if
if code=SOCKET_ERROR then crash("select (%v)",{get_socket_error()}) end if
if code>0 then -- (not timeout)
if code>0 then -- (not timeout)
atom peer = accept(sock),
atom peer = accept(sock),
Line 1,458: Line 1,458:
WSACleanup()</lang>
WSACleanup()</lang>
{{Out}}
{{Out}}
Server console, one you have opened http://localhost:8080 in your browser, or run curl http://localhost:8080
Server console, once you have opened http://localhost:8080 in your browser, or run curl http://localhost:8080
<pre>
<pre>
server started, open http://localhost:8080/ in browser or curl, press Esc or Q to quit
server started, open http://localhost:8080/ in browser or curl, press Esc or Q to quit