On Tue, 22 Dec 1998, Glynn Clements wrote:

> Yes. Which is the best approach depends upon whether the connections
> are related in any way.
> 
> For the case where the connections are all independent (e.g. 
> telnet/FTP/HTTP servers), using fork() is preferable.
> 
> For the case where the connections are related (e.g. a MUD or
> conferencing system), then either use select() or threads.

 Thanks alot for the great explanation! :) Now I already understand it!:-))

> You shouldn't need to use both select() and fork(). If you use fork(),
> then each process only deals with a single connection, so there is no
> need to use select().

 That's rigth ! :-) I had it working as I want using only fork()ing
processes! :-)

> You are probably including the line terminator. The expression
> 
>       strlen("nemanuel\r\n")
> 
> will return 10.

 That's rigth ! I need to put "\r\n" at the end of line comparation.

 About counting the number of connections, it's already done. I had used
shared memory for that.

 One question:

  i'm using the usually forking "scheme":

  if((pid=fork())==0)  /* child process */
  {
    ....
  }else{         /* parent process */
   
   
  }

 If i put on parent process:

  wait(NULL) - it doesn't do what I want(for I get messages for user #2,
user #1 need to disconnect - confused !? )

  waitpid(pid, NULL, 4) - I don't know understand third argument so I
wrote 4 ; but it works as i want! :)

  otherwise if I don't put wait() neither waitpid() function it works
as i want!:) What should i do ? User waitpid or just don't put
anything ?

 Thanks for all your pacience.

 Best regards,
  Nuno Carvalho

P.S. I'll be back! :) There are always something we don't know ...

������������������������������
   Nuno Emanuel F. Carvalho
 Dep. Informatics Engineering
    University of Coimbra

  PGP key available at finger
������������������������������

Reply via email to