home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!asuvax!ncar!vexcel!copper!slate!iarit
- From: iarit@slate.mines.colorado.edu (ARIT ISMAIL)
- Newsgroups: comp.unix.wizards
- Subject: client/server question...........
- Message-ID: <1993Jan26.222115.28187@slate.mines.colorado.edu>
- Date: 26 Jan 93 22:21:15 GMT
- Organization: Colorado School of Mines
- Lines: 46
-
- Hi,
-
- I don't know if this is the right place to post this, but
- I need some help about writing a simple client/server program.
-
- Here is what I am trying to do;
-
- I want to write a program that will accept connections from
- other programs and will communicate with them without forking.
- I don't want to fork because the info should be generated on one
- program, send to server and the server has to respond to every
- program connected with the same info( if I fork, how can I transfer
- that info to child?).
-
- main main
- client <--> server <--> client
- |
- |
- _______________________________
- | | | |
- v v v v
- client1 client2 client3 ......
-
- (main clients generate the info)
- I know this is not an easy thing to do, but actually, I am having
- problems with accept(..);
- can I do something like this;
-
- while(1)
- {
- check_new_connection(); /* how can I check if there is any new
- connection
- without waiting, as far as I know accept(..)
- blocks you 'till you get some connection*/
- check_clients(); /* I can do these, no problem. read if there is
- any new info */
- if(thereIsNewInfo)
- inform_clients(); /* if I can create a list of handles for clients
- this is no big deal */
-
- }
- My problem is getting new connections without waiting.
-
- I appreciate any help.
-
- iarit@slate.mines.colorado.edu
-