theMark001 / C-Quest-Minitalk

0 stars 0 forks source link

simple communicathion clien and server #2

Closed theMark001 closed 3 hours ago

theMark001 commented 3 hours ago

int main(int argc, char *argv[]) { pid_t target_pid = atoi(argv[1]); kill(target_pid, SIGUSR1); }


void signal_handler(int signal) { if (signal == SIGUSR1) { printf("Received SIGUSR1 signal!\n"); } }

int main() { signal(SIGUSR1, signal_handler);

while (1) { pause(); } }


    • ./my_server
    • ps aux | grep "[m]y_server"
    • ./my_client PID