[C] socket programming i'm stuck with that - Programming On Unix

Users browsing this thread: 1 Guest(s)
xero
Long time nixers
(17-09-2014, 08:12 AM)z3bra Wrote: Isn't there a fork bomb ?

Code:
bool ischild = false;
while (!ischild)
    if (!ischild) {
        fork();
    }
}

yes. that is exactly what that code is.
as a simple example to get you thinking, you need to see how many files to upload and only make a single fork for each.

Code:
int count = 0;
int total = 3;
bool ischild = false;
while (!ischild)
    if (!ischild) {
        fork();
        count++;
        if(count < total) {
            ischild = true;
       }
    }
}


Messages In This Thread
RE: [C] socket programming i'm stuck with that - by xero - 17-09-2014, 10:28 AM