[comp.unix.programmer] Internet stream sockets

leh@atlantis.cis.ufl.edu (Les Hill) (02/07/91)

In article <16278@sdcc6.ucsd.edu>, cs163wcr@sdcc10.ucsd.edu (C Code.  C Code Run.) writes:
|> [1] If I set up a server socket with "listen (s,2)" (with all proper
|> 	error checking) and I'm talking with someone on the first
|> 	connection, and someone connects to the second connection, how is
|> 	the program notified?

When you use accept() you will get a brand new socket descriptor, the old listen()'ed socket is still listening -- I think you may have a misconception of what listen does.

|> [2] Can I use this strategy to implement a mini-conference?

Yes.

|> [3] Can I do all of this without using fork()?

Sure.  Use a socket for each active connection, multiplex using select() (which you can use to check for new connections.)  If you are clever, you don't even need a "server" process.

|> Steve Boswell
|> whatis@ucsd.edu
-- 
Extraordinary crimes against the people and the state have to be avenged by
agents extraordinary.  Two such people are John Steed -- top professional, and
his partner, Emma Peel -- talented amateur; otherwise known as "The Avengers."
UUCP: ...!gatech!uflorida!leh    BITNET: vishnu@UFPINE    INTERNET: leh@ufl.edu