newbie erlang programmer has a newbie problem.. :)

Klacke klacke@REDACTED
Mon Nov 20 10:40:38 CET 2000


> 
> -module (server).
> -export ([start/1,beginserver/1]).
> 
> start(Port) ->
>     spawn(server, beginserver, [Port]).
> 
> beginserver(Port) ->
>     {ok, Lsock} = gen_tcp:listen(Port, [binary, {packet, 0},{active, 
> false},{backlog,4}]),
>     serverloop(Lsock,1).
> 
> serverloop(Lsock, Nuser) ->
>     {ok, Sock} = gen_tcp:accept(Lsock),
>     io:format ("welcome to SuperServer 0.0\nyou are user #~w\n",
> [Nuser]),
>     serverloop(Lsock, Nuser+1).
> 
> --------------


Looks just fine to me.


/klacke


-- 
Claes Wikstrom                        -- Caps is nowhere and
Alteon WebSystems                     -- everything is under control          
http://www.bluetail.com/~klacke       --




More information about the erlang-questions mailing list