Nog een poging...
This commit is contained in:
parent
8c271feb87
commit
3c8d9e4f54
1 changed files with 4 additions and 5 deletions
|
@ -5,7 +5,8 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
//for connection to server
|
//for connection to server
|
||||||
#include "../sockets/SocketW.h"
|
#include "../sockets/SocketW.h"
|
||||||
|
@ -22,12 +23,10 @@ FILE * CONN = 0;
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
|
|
||||||
//automatic child reaping
|
|
||||||
struct sigaction sa = {sa_handler = SIG_IGN};
|
|
||||||
sigaction(SIGCHLD, &sa, NULL);
|
|
||||||
|
|
||||||
int server_socket = DDV_Listen(1935);
|
int server_socket = DDV_Listen(1935);
|
||||||
|
int status;
|
||||||
while (server_socket > 0){
|
while (server_socket > 0){
|
||||||
|
waitpid((pid_t)-1, &status, WNOHANG);
|
||||||
CONN = DDV_Accept(server_socket);
|
CONN = DDV_Accept(server_socket);
|
||||||
pid_t myid = fork();
|
pid_t myid = fork();
|
||||||
if (myid == 0){
|
if (myid == 0){
|
||||||
|
|
Loading…
Add table
Reference in a new issue