Hello world/Web server: Difference between revisions

m
Corrected typo, better names.
(Changed to use builtin HTTP server)
m (Corrected typo, better names.)
Line 333:
-module( hello_world_web_server ).
 
-export( [do/1, inets_starthttpd_start/2, inets_stophttpd_stop/1, task/0] ).
 
do( _Data ) ->
{proceed, [{response,{200,"Goodbye, World!"}}]}.
 
inets_starthttpd_start( Port, Module ) ->
Arguments = [{bind_address, "localhost"}, {port, Port}, {ipfamily, inet},
{modules, [Module]},
Line 345:
Pid.
inets_stophttpd_stop( Pid ) ->
inets:stop( stand_alone, Pid ).
 
task() ->
Pid = inets_starthttpd_start( 8080, ?MODULE ),
timer:sleep( 1000030000 ),
inets_stophttpd_stop( Pid ).
</lang>
 
Anonymous user