Internet stream sockets

Les Hill leh at atlantis.cis.ufl.edu
Thu Feb 7 06:49:26 AEST 1991


In article <16278 at sdcc6.ucsd.edu>, cs163wcr at 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 at 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 at UFPINE    INTERNET: leh at ufl.edu



More information about the Comp.unix.programmer mailing list