Ask a Question related to UNIX Programming, Design and Development.
-
Rainer Temme #1
Re: Socket programming help needed urgently
"sridhar" <gsridhar78@yahoo.com>wrote:.... snipped out> I am sending request to exicute a script from a client
> machine(solaris 8) to server machine(linux) thru my Client.c and
> Server.c programs. If i send one connection at a time immediately
> returns the output. If there more than one request or connection(ie to
> execute more than one script at a time).. it takes time to return the
> output. This problem is only in Linux Platform.. It works perfectly in
> Solaris Environment.I am sending client and server programs as below
>
> client program.... big parts snipped out> Server program
> void sigchld_handler(int s)
> {
> while(wait(NULL) > 0);
> }......> int main(void)
> /************************************************** **********
> FUNCTION MAIN
> ************************************************** ***********/
> {> struct sigaction sa;
> sa.sa_handler = sigchld_handler; // reap all dead processes
> sigemptyset(&sa.sa_mask);
> sa.sa_flags = SA_RESTART;
> if (sigaction(SIGCHLD, &sa, NULL) == -1) {
> strcpy(msg,"Sigaction");
Hi sridhar,
You've introduced a signal-handler within the server-code, to clean up
all terminated child-processes. (This is a good idea.)
You've designed this signal-handler to be able to get rid of more than
only a single child...by looping in the while()-loop ... (another good
idea.)
But, to my knowledge, wait() will return imediately, if ...
... the exit-code of a child is available
... there is no more child left
... a signal interrupts it
wait() will block, if there are one ore more child-processes running.
Depending on the run-time-needs of the childs, the server (holding
the listener socket) might be caught in this while-loop,
if more than one child is executed, and the first child terminates.
A good idea might be to use waitpid() instead of wait().
waitpit() offers more flexibility ...
you would use it with the pid-param set to -1 to have the
same functionality as wait() has got, but you would use it
with option=WNOHANG
In this case, waitpit() doesn't block, if no actual exit-code
is available, but children are still executed.
regards ... rainer
Rainer Temme Guest
-
cfloop help urgently needed!!!
how do i output a loop with a dash and and a sequence. for example 1010-1, 1010-2, 1010-3, 1010-4, 1010-5 .......1010-99, 1010-100. -
Brush Advice Needed Urgently!
Does anyone have any quick advice on how to do a brush that looks realistically like a ballpoint pen? (ie: generally even weight but with small,... -
help needed urgently!!!
if you know something about flashMX2004 and the trial version could you go to my other post in general discussion please??? I really nadly need help,... -
Calling Web Services Dynamically - Help Urgently needed
We have 2 web services: Payments: Allows uses to pay using ACH (ACHDebit.asmx) or Credit Cards (CCDebit.asmx), and it has adminstration functions... -
urgently needed
why?



Reply With Quote

