newbie erlang programmer has a newbie problem.. :)
INTERFAC
INTERFAC@REDACTED
Sun Nov 19 03:01:27 CET 2000
hi all,
first of all, greetings to all people in the list, this is my first
email..
What i'm trying is a very simple program, thought i cannot resolve,
since i've just started with erlang. Its a tcp server that only has to
tell to the clients that "you are user number X", and when there are 4
users connected, reject them with a message like: "there are finnaly 4
users, bye!".
i have an initial code like this:
--------------------------
-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).
--------------
but doesnt works. Anyone could help me?
thanks in advance,
Diego Fernandez
Spain
___________________________________________________________________
Consigue tu e-mail gratuito TERRA.ES
Haz click en http://www.terra.es/correo/
More information about the erlang-questions
mailing list