Ask a Question related to UNIX Programming, Design and Development.
-
Matt Gessner #1
Re: asking help for a peer-to-peer socket programming question
[email]g14619@yahoo.com[/email] (Amy) wrote in message news:<8977bd67.0307160135.3171cebb@posting.google. com>...
I've been thinking about this for a little bit now. I think you need> Hi,
>
> I am writing a socket program in C for a simple concurrent chat
> server, (probably) with fork, NO select() or multithread at this
> moment, and here is my question:
>
> how can I get the previously forked children to know necessary info
> about these lately-generated children so they can communicate with
> each other in a peer-to-peer chatting environment? What is the way to
> let elder child process(es) know and talk to these younger child
> process(es)?
>
> any suggestion or opinion is highly appreciated.
>
> Amy
to ask/answer some question about what you're trying to do, because if
you don't give careful consideration to some limitations, you're going
to hit a wall.
a) How many concurrent children do you want to support?
If the number is small (a couple hundred), I'd suggest using pipes between
each child and the parent, and each child can send messages to the parent
which the parent will broadcast out it's collection of active pipes.
You could probably also do the same thing with sockets or shared memory.
b) Are there enough resources configured in the kernel to allow for this?
If not, you're going to have to go in and tweak your kernel. If there's not
enough physical resources, you're going to need to add some :) This is only
if you're planning to have a really big number.
You might consider looking at how IRC servers are designed. They do much
the same thing as I understand you're trying to do. This is only if you
are very brave :)
Next: how are you planning on doing this without select()? You don't give
too many details, but as I see it, you're going to have at least 2 active
IPC paths for each child: one to the parent, and one to the client. You're
going to need some way to do this. Are you going to use non-blocking
sockets or something like that?
Good luck.
HTH
Matt Gessner Guest
-
Patch deployment in a peer-to-peer setting
We are a non-profit in a remote area of Nebraska relying on 56K dialups for email and internet. We would like to download security/product... -
Can't ping both ways in ME/XP peer to peer network.
In article <00ac01c34119$4558ef30$a001280a@phx.gbl>, "Doug" <ddescalzi@medrad.com> wrote: One-way pings and failure of a computer to ping itself... -
peer to peer network between xp-home and win98
In article <01f301c33dc0$1fc33d90$a301280a@phx.gbl>, "nick savich" <nicksavich@sev.org> wrote: Run XP's Network Setup Wizard on both computers. ... -
WindowsXP Pro and Windows98SE in a peer to peer workgroup
The XP pro machine can see all the computers on the network, and has access to them all. The 98SE computers have access to each other, but when... -
ability to browse shared folders is one-way on a WinXP peer-peer network
Thanks for this tip - I was about to post when I saw your response. Just the adrenaline rush from the mere *hope* of a fix was enough to pick me up... -
Amy #2
Re: asking help for a peer-to-peer socket programming question
[email]mgessner@yahoo.com[/email] (Matt Gessner) wrote in message news:<909a6ea3.0307160528.52708be0@posting.google. com>...
Hi,> [email]g14619@yahoo.com[/email] (Amy) wrote in message news:<8977bd67.0307160135.3171cebb@posting.google. com>...
Thank you very much to help me out. Please refer to the insertion for
the answers to your questions.
AmyAmy's answer: Only ten children I want to support ( it is a really>> > Hi,
> >
> > I am writing a socket program in C for a simple concurrent chat
> > server, (probably) with fork, NO select() or multithread at this
> > moment, and here is my question:
> >
> > how can I get the previously forked children to know necessary info
> > about these lately-generated children so they can communicate with
> > each other in a peer-to-peer chatting environment? What is the way to
> > let elder child process(es) know and talk to these younger child
> > process(es)?
> >
> > any suggestion or opinion is highly appreciated.
> >
> > Amy
> I've been thinking about this for a little bit now. I think you need
> to ask/answer some question about what you're trying to do, because if
> you don't give careful consideration to some limitations, you're going
> to hit a wall.
>
> a) How many concurrent children do you want to support?
>
> If the number is small (a couple hundred), I'd suggest using pipes between
> each child and the parent, and each child can send messages to the parent
> which the parent will broadcast out it's collection of active pipes.
>
> You could probably also do the same thing with sockets or shared memory.
tiny chat server)
Amy's answer: Yes, it is a non-blocking and concurrent server. I use> b) Are there enough resources configured in the kernel to allow for this?
>
> If not, you're going to have to go in and tweak your kernel. If there's not
> enough physical resources, you're going to need to add some :) This is only
> if you're planning to have a really big number.
>
> You might consider looking at how IRC servers are designed. They do much
> the same thing as I understand you're trying to do. This is only if you
> are very brave :)
>
> Next: how are you planning on doing this without select()? You don't give
> too many details, but as I see it, you're going to have at least 2 active
> IPC paths for each child: one to the parent, and one to the client. You're
> going to need some way to do this. Are you going to use non-blocking
> sockets or something like that?
fork() to have the child process to handle login client and let parent
listen to the incoming request. Since broadcast chatting messages is
required, so I have to make the old children know the newly incoming
clients' information (socket discriptor)in order to broadcast messages
to them.
> Good luck.
>
> HTHAmy Guest



Reply With Quote

