Skip to content

Commit

Permalink
First lines of code for server and client
Browse files Browse the repository at this point in the history
  • Loading branch information
izzypt committed Apr 6, 2023
1 parent 0a641b7 commit 0a90585
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Binary file removed a.out
Binary file not shown.
11 changes: 11 additions & 0 deletions client.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <unistd.h>
#include <stdio.h>
#include <signal.h>

int main(int argc, char **argv)
{
printf("The process id of the server is: %d\n", 526);
printf("Client ready to send signals..\n");
printf("%s\n", argv[0]);
kill(526, 12);
}
16 changes: 16 additions & 0 deletions server.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#include <unistd.h>
#include <stdio.h>
#include <signal.h>

void handle_sigusr(int sig)
{
printf("Received signal %d\n", sig);

printf("Received some signal!");
}

int main(int argc, char **argv)
{
Expand All @@ -8,4 +16,12 @@ int main(int argc, char **argv)
pid = getpid();

printf("The process id of the server is: %d\n", pid);
printf("Waiting for signals..\n");

signal(SIGUSR1, handle_sigusr);

while (1)
{

}
}

0 comments on commit 0a90585

Please sign in to comment.