Skip to content

A project with 2 binaries: client and server communicating with signals.

License

Notifications You must be signed in to change notification settings

Dowiw/42_minitalk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42_minitalk

A project on signal handling in C.

It involves signal processing using the functions inside signal(2) in the standard C library.

Unfortunately, Linux does not queue signals. One way to handle that is to sleep for the right amount of microseconds.

Description: Two binaries ./client and ./server must communicate with each other through signals. Where, the client (supplied with the server pid) sends strings to a listening server.

Extras: Have a way to receive unicode characters and the server must acknowledge the client by sending back a signal.

Usage

Tested with:

  • GCC 10.5
  • C17
  • Ubuntu Linux (natively and in Windows 11 WSL)

To compile ./server and ./client:

make

To test:

  • Run ./server which will display its pid and listen for signals.
  • Run ./client <server_pid> <string> which will send the string to the server.

Note: Extra work are in the same binaries. Though, in some cases, unicode will not print depending on terminal formatting.

Results

TODO

  • signal handling is straightforward.

References

  • kimylamp's video on signals. A dive into how signals are processed inside the operating system.
  • Nic Barker's video on the UTF-8 format which talks about how these characters are stored in bits.
  • The GNU manual on signal(2). References on return values and smart signal structs.

Made in C

About

A project with 2 binaries: client and server communicating with signals.

Topics

Resources

License

Stars

Watchers

Forks