home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / wizards / 5663 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.8 KB

  1. Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!asuvax!ncar!vexcel!copper!slate!iarit
  2. From: iarit@slate.mines.colorado.edu (ARIT ISMAIL)
  3. Newsgroups: comp.unix.wizards
  4. Subject: client/server question...........
  5. Message-ID: <1993Jan26.222115.28187@slate.mines.colorado.edu>
  6. Date: 26 Jan 93 22:21:15 GMT
  7. Organization: Colorado School of Mines
  8. Lines: 46
  9.  
  10. Hi,
  11.  
  12. I don't know if this is the right place to post this, but
  13. I need some help about writing a simple client/server program.
  14.  
  15. Here is what I am trying to do;
  16.  
  17. I want to write a program that will accept connections from
  18. other programs and will communicate with them without forking.
  19. I don't want to fork because the info should be generated on one
  20. program, send to server and the server has to respond to every
  21. program connected with the same info( if I fork, how  can I transfer
  22. that info to child?).
  23.  
  24.   main                     main
  25.   client <--> server <--> client
  26.                 |
  27.                 |
  28.          _______________________________
  29.          |         |        |        |
  30.          v         v        v        v
  31.        client1  client2  client3     ......
  32.  
  33. (main clients generate the info)
  34. I know this is not an easy thing to do, but actually, I am having
  35. problems with accept(..);
  36. can I do something like this;
  37.  
  38. while(1)
  39. {
  40.  check_new_connection(); /* how can I check if there is any new
  41. connection
  42.                            without waiting, as far as I know accept(..)
  43.                            blocks you 'till you get some connection*/
  44.  check_clients();       /* I can do these, no problem. read if there is
  45.                            any new info */
  46.  if(thereIsNewInfo)
  47.    inform_clients();     /* if I can create a list of handles for clients
  48.                            this is no big deal */
  49.  
  50. }
  51. My problem is getting new connections without waiting.
  52.  
  53. I appreciate any help.
  54.  
  55. iarit@slate.mines.colorado.edu
  56.