For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > March 2004 > send() problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author send() problem
Tejas Kokje

2004-03-27, 12:16 am

hi,

I have written a code for forking child processes which connect to
parent tcp process.
However when I fork child processes (say 5) all of them connect to
parent process. however when i send pid of child to parent,
only some of the child send pid to parent. (yes i know what parent who
has forked child knows their pid, however i am required to send
pid from child to parent explicitly)

Please download the code from the following link

http://www-scf.usc.edu/~kokje/code.tar

to compile use

gcc -lnsl -lsocket master.c -o master

to run
../master < s1.in

only 4 send are generated . I am using it on solaris which is heavly
loaded. When i run it on local computer, it runs fine.

I am not able to find the error . Please help me
Marc Rochkind

2004-03-27, 12:16 am


"Tejas Kokje" <kokje@usc.edu> wrote in message
news:pan.2004.03.23.02.10.39.765956@usc.edu...
> hi,
>
> I have written a code for forking child processes which connect to
> parent tcp process.
> However when I fork child processes (say 5) all of them connect to
> parent process. however when i send pid of child to parent,
> only some of the child send pid to parent. (yes i know what parent who
> has forked child knows their pid, however i am required to send
> pid from child to parent explicitly)
>
> Please download the code from the following link
>
> http://www-scf.usc.edu/~kokje/code.tar
>
> to compile use
>
> gcc -lnsl -lsocket master.c -o master
>
> to run
> ./master < s1.in
>
> only 4 send are generated . I am using it on solaris which is heavly
> loaded. When i run it on local computer, it runs fine.
>
> I am not able to find the error . Please help me


Sorry, I haven't looked at your code. Because it's a tar file and you've
included compilation instructions, many readers will assume that it will
take time to look through it, and I don't know that anyone (who knows the
answer) will take the time. But, one general question is this; Are you
checking the error return from every system call and function that has one,
and are you checking for the exact return that the docs say you should
(NULL, -1, 0, whatever)? Don't even start looking for logical problems until
you've done that.

Hope this helps...

--
Marc Rochkind
"Advanced UNIX Programming" (publishing April 2004)
www.basepath.com/aup


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com